changeset e59b6fdc6573 in modules/purchase:5.0
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=e59b6fdc6573
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 514b3b61eaa9 -r e59b6fdc6573 purchase.py
--- a/purchase.py       Thu Jun 17 22:02:50 2021 +0200
+++ b/purchase.py       Mon Jul 12 22:37:21 2021 +0200
@@ -1296,7 +1296,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
 
@@ -1304,7 +1305,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