Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
cbcf0252 by Christophe at 2023-04-08T14:11:03+02:00
Do not set unit prices for product without list and gross price

Closes #12044
- - - - -


1 changed file:

- modules/sale_point/sale.py


Changes:

=====================================
modules/sale_point/sale.py
=====================================
@@ -530,6 +530,9 @@
     def on_change_product(self):
         pool = Pool()
         Tax = pool.get('account.tax')
+
+        self.unit_gross_price = None
+        self.unit_list_price = None
         if self.product and self.sale and self.sale.point:
             if (self.sale.point.tax_included
                     and self.product.gross_price is not None):
@@ -537,7 +540,7 @@
                 self.unit_list_price = round_price(Tax.reverse_compute(
                         self.unit_gross_price, self.taxes,
                         date=self.sale.date))
-            else:
+            elif self.product.list_price is not None:
                 self.unit_list_price = self.product.list_price
                 taxes = Tax.compute(
                     self.taxes, self.unit_list_price, 1,
@@ -547,9 +550,6 @@
                     self.unit_list_price + tax_amount).quantize(
                         Decimal(1)
                         / 10 ** self.__class__.unit_gross_price.digits[1])
-        else:
-            self.unit_gross_price = None
-            self.unit_list_price = None
         self.unit_price = self.on_change_with_unit_price()
         self.amount = self.on_change_with_amount()
 



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/cbcf0252c94f0b7a6ac4e24d7bfb164e7c4cdda9

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/cbcf0252c94f0b7a6ac4e24d7bfb164e7c4cdda9
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to