From 1bb42091bedab80e61bb95bd3615fe62000ba3d3 Mon Sep 17 00:00:00 2001 From: Vincent Mundo Date: Mon, 12 Sep 2022 11:39:58 +0200 Subject: [PATCH 1/2] fix_pos_orderline_absolute_discount --- .../models/pos_order_model.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pos_orderline_absolute_discount/models/pos_order_model.py b/pos_orderline_absolute_discount/models/pos_order_model.py index 07e07d034a..04be7c2140 100644 --- a/pos_orderline_absolute_discount/models/pos_order_model.py +++ b/pos_orderline_absolute_discount/models/pos_order_model.py @@ -53,6 +53,8 @@ def _compute_amount_line_all(self): if fpos else line.tax_ids ) + price = line.price_unit + taxes = tax_ids_after_fiscal_position.compute_all(price, self.order_id.pricelist_id.currency_id, self.qty, product=self.product_id, partner=self.order_id.partner_id) if line.absolute_discount: price = line.price_unit - line.absolute_discount taxes = tax_ids_after_fiscal_position.compute_all( @@ -62,12 +64,10 @@ def _compute_amount_line_all(self): product=line.product_id, partner=line.order_id.partner_id, ) - line.update( - { - "price_subtotal_incl": taxes["total_included"], - "price_subtotal": taxes["total_excluded"], - } - ) + return { + "price_subtotal_incl": taxes["total_included"], + "price_subtotal": taxes["total_excluded"], + } @api.onchange("qty", "discount", "price_unit", "tax_ids", "absolute_discount") def _onchange_qty(self): From b1ba878d70f1d2ea466df37f772922caf7baabd9 Mon Sep 17 00:00:00 2001 From: Vincent Mundo Date: Tue, 13 Sep 2022 11:47:08 +0200 Subject: [PATCH 2/2] Fix pos_orderline_absolute_discount --- .../models/pos_order_model.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pos_orderline_absolute_discount/models/pos_order_model.py b/pos_orderline_absolute_discount/models/pos_order_model.py index 04be7c2140..ae7494417b 100644 --- a/pos_orderline_absolute_discount/models/pos_order_model.py +++ b/pos_orderline_absolute_discount/models/pos_order_model.py @@ -45,7 +45,7 @@ class PosOrderLine(models.Model): "price_unit", "tax_ids", "qty", "discount", "product_id", "absolute_discount" ) def _compute_amount_line_all(self): - super(PosOrderLine, self)._compute_amount_line_all() + res = super(PosOrderLine, self)._compute_amount_line_all() for line in self: fpos = line.order_id.fiscal_position_id tax_ids_after_fiscal_position = ( @@ -53,8 +53,6 @@ def _compute_amount_line_all(self): if fpos else line.tax_ids ) - price = line.price_unit - taxes = tax_ids_after_fiscal_position.compute_all(price, self.order_id.pricelist_id.currency_id, self.qty, product=self.product_id, partner=self.order_id.partner_id) if line.absolute_discount: price = line.price_unit - line.absolute_discount taxes = tax_ids_after_fiscal_position.compute_all( @@ -64,10 +62,13 @@ def _compute_amount_line_all(self): product=line.product_id, partner=line.order_id.partner_id, ) - return { - "price_subtotal_incl": taxes["total_included"], - "price_subtotal": taxes["total_excluded"], - } + res.update( + { + "price_subtotal_incl": taxes["total_included"], + "price_subtotal": taxes["total_excluded"], + } + ) + return res @api.onchange("qty", "discount", "price_unit", "tax_ids", "absolute_discount") def _onchange_qty(self):