changeset 9493e3b2bf24 in modules/purchase:default
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=9493e3b2bf24
description:
        Return existing unit price when compute for line without product

        issue10962
        review391151002
diffstat:

 purchase.py |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 49a612454113 -r 9493e3b2bf24 purchase.py
--- a/purchase.py       Fri Oct 07 15:00:40 2022 +0200
+++ b/purchase.py       Mon Oct 10 18:27:01 2022 +0200
@@ -1348,14 +1348,14 @@
                 taxes.update(tax_ids)
         return list(taxes)
 
-    @fields.depends('product', 'quantity',
+    @fields.depends('product', 'quantity', 'unit_price',
         methods=['_get_context_purchase_price'])
     def compute_unit_price(self):
         pool = Pool()
         Product = pool.get('product.product')
 
         if not self.product:
-            return
+            return self.unit_price
 
         with Transaction().set_context(self._get_context_purchase_price()):
             unit_price = Product.get_purchase_price([self.product],

Reply via email to