[FIX] point_of_sale: onchange call order

_onchange_qty should be called after the price_unit change to compute 
the amounts correctly.
This commit is contained in:
Victor Feyens
2021-06-17 12:14:36 +00:00
parent 9df95cb554
commit 7ab7bd92ea
+1 -1
View File
@@ -834,10 +834,10 @@ class PosOrderLine(models.Model):
'Please set one before choosing a product.'))
price = self.order_id.pricelist_id.get_product_price(
self.product_id, self.qty or 1.0, self.order_id.partner_id)
self._onchange_qty()
self.tax_ids = self.product_id.taxes_id.filtered(lambda r: not self.company_id or r.company_id == self.company_id)
tax_ids_after_fiscal_position = self.order_id.fiscal_position_id.map_tax(self.tax_ids)
self.price_unit = self.env['account.tax']._fix_tax_included_price_company(price, self.product_id.taxes_id, tax_ids_after_fiscal_position, self.company_id)
self._onchange_qty()
@api.onchange('qty', 'discount', 'price_unit', 'tax_ids')
def _onchange_qty(self):