From 7fab2bb7791ead706d8d4646656ab985bb662db0 Mon Sep 17 00:00:00 2001 From: Parthiv Patel Date: Wed, 10 Nov 2021 09:36:58 +0000 Subject: [PATCH] [PATCH] Upstream patch - 10112021 --- addons/delivery/models/sale_order.py | 2 +- addons/mrp/report/mrp_report_bom_structure.py | 1 + addons/mrp/tests/test_bom.py | 46 +++++++++++++++++++ .../static/src/css/pos_receipts.css | 10 ++++ .../static/src/xml/SaleDetailsReport.xml | 2 +- .../Screens/ReceiptScreen/OrderReceipt.xml | 4 +- .../website/static/src/xml/website.editor.xml | 4 +- 7 files changed, 63 insertions(+), 6 deletions(-) diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py index fc841632bb..0362aaa04a 100644 --- a/addons/delivery/models/sale_order.py +++ b/addons/delivery/models/sale_order.py @@ -118,7 +118,7 @@ class SaleOrder(models.Model): else: values['price_unit'] = price_unit if carrier.free_over and self.currency_id.is_zero(price_unit) : - values['name'] += '\n' + 'Free Shipping' + values['name'] += '\n' + _('Free Shipping') if self.order_line: values['sequence'] = self.order_line[-1].sequence + 1 sol = SaleOrderLine.sudo().create(values) diff --git a/addons/mrp/report/mrp_report_bom_structure.py b/addons/mrp/report/mrp_report_bom_structure.py index b4a19397f3..59e9c7898f 100644 --- a/addons/mrp/report/mrp_report_bom_structure.py +++ b/addons/mrp/report/mrp_report_bom_structure.py @@ -169,6 +169,7 @@ class ReportBomStructure(models.AbstractModel): def _get_operation_line(self, bom, qty, level): operations = [] total = 0.0 + qty = bom.product_uom_id._compute_quantity(qty, bom.product_tmpl_id.uom_id) for operation in bom.operation_ids: operation_cycle = float_round(qty / operation.workcenter_id.capacity, precision_rounding=1, rounding_method='UP') duration_expected = operation_cycle * operation.time_cycle + operation.workcenter_id.time_stop + operation.workcenter_id.time_start diff --git a/addons/mrp/tests/test_bom.py b/addons/mrp/tests/test_bom.py index f7c943b86f..913d28e9ea 100644 --- a/addons/mrp/tests/test_bom.py +++ b/addons/mrp/tests/test_bom.py @@ -497,6 +497,52 @@ class TestBoM(TestMrpCommon): # total price = 15.51 + crumble_cost + operation_cost(10 + 1.67 = 11.67) = 27.18 + crumble_cost self.assertEqual(float_compare(report_values['lines']['total'], 27.18 + crumble_cost, precision_digits=2), 0, 'Product Bom Price is not correct') + def test_bom_report_dozens(self): + """ Simulate a drawer bom with dozens as bom units + """ + uom_dozen = self.env.ref('uom.product_uom_dozen') + uom_unit = self.env.ref('uom.product_uom_unit') + drawer = self.env['product.product'].create({ + 'name': 'drawer', + 'type': 'product', + 'uom_id': uom_unit.id, + 'uom_po_id': uom_unit.id, + }) + screw = self.env['product.product'].create({ + 'name': 'screw', + 'type': 'product', + 'uom_id': uom_unit.id, + 'uom_po_id': uom_unit.id, + 'standard_price': 7.01 + }) + + bom_form_drawer = Form(self.env['mrp.bom']) + bom_form_drawer.product_tmpl_id = drawer.product_tmpl_id + bom_form_drawer.product_qty = 11 + bom_form_drawer.product_uom_id = uom_dozen + bom_drawer = bom_form_drawer.save() + + workcenter = self.env['mrp.workcenter'].create({ + 'costs_hour': 10, + 'name': 'Deserts Table' + }) + + with Form(bom_drawer) as bom: + with bom.bom_line_ids.new() as line: + line.product_id = screw + line.product_uom_id = uom_unit + line.product_qty = 5 + with bom.operation_ids.new() as operation: + operation.workcenter_id = workcenter + operation.name = 'Screw drawer' + operation.time_cycle_manual = 5 + + # TEST BOM STRUCTURE VALUE WITH BOM QUANTITY + report_values = self.env['report.mrp.report_bom_structure']._get_report_data(bom_id=bom_drawer.id, searchQty=11, searchVariant=False) + # 5 min 'Prepare biscuits' + 3 min 'Prepare butter' + 5 min 'Mix manually' = 13 minutes + self.assertEqual(report_values['lines']['operations_time'], 60.0, 'Operation time should be the same for 1 unit or for the batch') + + def test_21_bom_report_variant(self): """ Test a sub BoM process with multiple variants. BOM 1: diff --git a/addons/point_of_sale/static/src/css/pos_receipts.css b/addons/point_of_sale/static/src/css/pos_receipts.css index b8ed9af277..d33b450d04 100644 --- a/addons/point_of_sale/static/src/css/pos_receipts.css +++ b/addons/point_of_sale/static/src/css/pos_receipts.css @@ -63,3 +63,13 @@ text-align: center; font-size: 75%; } + +.responsive-price { + display: flex; + flex-wrap: wrap; + width: 100%; +} + +.responsive-price > .pos-receipt-right-align { + margin-left: auto; +} diff --git a/addons/point_of_sale/static/src/xml/SaleDetailsReport.xml b/addons/point_of_sale/static/src/xml/SaleDetailsReport.xml index cce9616e97..b818b54625 100644 --- a/addons/point_of_sale/static/src/xml/SaleDetailsReport.xml +++ b/addons/point_of_sale/static/src/xml/SaleDetailsReport.xml @@ -15,7 +15,7 @@
-
+
diff --git a/addons/point_of_sale/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml b/addons/point_of_sale/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml index 379b360d26..f353b4c426 100644 --- a/addons/point_of_sale/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml +++ b/addons/point_of_sale/static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml @@ -49,7 +49,7 @@
-
+
@@ -111,7 +111,7 @@
Subtotal
-
+
diff --git a/addons/website/static/src/xml/website.editor.xml b/addons/website/static/src/xml/website.editor.xml index 3ce515bda4..86ecd2167e 100644 --- a/addons/website/static/src/xml/website.editor.xml +++ b/addons/website/static/src/xml/website.editor.xml @@ -12,11 +12,11 @@
-
+
-
+