diff --git a/account_invoice_pricelist/__manifest__.py b/account_invoice_pricelist/__manifest__.py index 82c9a50b3a9f..72b2c74e773e 100644 --- a/account_invoice_pricelist/__manifest__.py +++ b/account_invoice_pricelist/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Account - Pricelist on Invoices", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "summary": "Add partner pricelist on invoices", "category": "Accounting & Finance", "author": "GRAP," "Therp BV," "Tecnativa," "Odoo Community Association (OCA)", diff --git a/account_invoice_pricelist/models/account_move.py b/account_invoice_pricelist/models/account_move.py index a1d3da3a14ed..60a9c90989ce 100644 --- a/account_invoice_pricelist/models/account_move.py +++ b/account_invoice_pricelist/models/account_move.py @@ -98,8 +98,9 @@ def _onchange_uom_id(self): sel.with_context(check_move_validity=False).update( {"price_unit": price_unit} ) + return else: - super(AccountMoveLine, self)._onchange_uom_id() + return super(AccountMoveLine, self)._onchange_uom_id() def _get_real_price_currency(self, product, rule_id, qty, uom, pricelist_id): PricelistItem = self.env["product.pricelist.item"] @@ -188,19 +189,17 @@ def _get_price_with_pricelist(self): ) self.with_context(check_move_validity=False).discount = 0.0 else: - product_context = dict( - self.env.context, + final_price, rule_id = self.move_id.pricelist_id.with_context( partner_id=self.move_id.partner_id.id, date=self.move_id.invoice_date or fields.Date.today(), uom=self.product_uom_id.id, - ) - final_price, rule_id = self.move_id.pricelist_id.with_context( - product_context ).get_product_price_rule( self.product_id, self.quantity or 1.0, self.move_id.partner_id ) base_price, currency = self.with_context( - product_context + partner_id=self.move_id.partner_id.id, + date=self.move_id.invoice_date or fields.Date.today(), + uom=self.product_uom_id.id, )._get_real_price_currency( self.product_id, rule_id,