From 2320a266d0499c4f8dbca10efcce392032efa1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 6 Dec 2020 00:35:52 +0100 Subject: [PATCH] Convert base price to the line unit issue9917 review308811002 --- sale.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sale.py b/sale.py index 06e839d790..ff385ae82c 100644 --- a/sale.py +++ b/sale.py @@ -56,10 +56,16 @@ class Line(metaclass=PoolMeta): self.discount_amount = self.on_change_with_discount_amount() self.discount = self.on_change_with_discount() - @fields.depends('product') + @fields.depends('product', 'unit') def compute_base_price(self): + pool = Pool() + Uom = pool.get('product.uom') if self.product: - return round_price(self.product.list_price) + price = self.product.list_price + if self.unit: + price = Uom.compute_price( + self.product.default_uom, price, self.unit) + return round_price(price) @fields.depends( methods=[