changeset 5ec0df19f8c4 in modules/purchase:5.8
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=5ec0df19f8c4
description:
        Do not use supplier location if empty

        issue10240
        review350071002
        (grafted from 9d974b18ef9d11a7f4a62c044d4f1110d39f559c)
diffstat:

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

diffs (22 lines):

diff -r 90ebe3dc512d -r 5ec0df19f8c4 purchase.py
--- a/purchase.py       Thu Jun 17 21:32:00 2021 +0200
+++ b/purchase.py       Mon Jul 12 22:37:21 2021 +0200
@@ -1391,7 +1391,8 @@
 
     def get_from_location(self, name):
         if (self.quantity or 0) >= 0:
-            return self.purchase.party.supplier_location.id
+            if self.purchase.party.supplier_location:
+                return self.purchase.party.supplier_location.id
         elif self.purchase.return_from_location:
             return self.purchase.return_from_location.id
 
@@ -1399,7 +1400,7 @@
         if (self.quantity or 0) >= 0:
             if self.purchase.warehouse:
                 return self.purchase.warehouse.input_location.id
-        else:
+        elif self.purchase.party.supplier_location:
             return self.purchase.party.supplier_location.id
 
     @fields.depends('product_supplier', 'quantity', 'moves', 'purchase',

Reply via email to