changeset b3d3410052bf in modules/purchase:6.0
details: https://hg.tryton.org/modules/purchase?cmd=changeset&node=b3d3410052bf
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 bf6e0f54e70d -r b3d3410052bf purchase.py
--- a/purchase.py       Thu Jun 17 21:31:11 2021 +0200
+++ b/purchase.py       Mon Jul 12 22:37:21 2021 +0200
@@ -1433,7 +1433,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
 
@@ -1441,7 +1442,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('moves', methods=['planned_delivery_date'])

Reply via email to