changeset 14677bf7ac44 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=14677bf7ac44
description:
        Set only existing default warehouse in default locations

        The default warehouse may be None which is not a valid value in the 
list for
        the default locations.

        issue9547
        review302041002
diffstat:

 product.py |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r f355521d6eb1 -r 14677bf7ac44 product.py
--- a/product.py        Sun Aug 16 16:52:00 2020 +0200
+++ b/product.py        Sat Aug 29 18:24:38 2020 +0200
@@ -167,7 +167,11 @@
     def default_locations(cls):
         pool = Pool()
         Location = pool.get('stock.location')
-        return [Location.get_default_warehouse()]
+        locations = []
+        warehouse = Location.get_default_warehouse()
+        if warehouse:
+            locations.append(warehouse)
+        return locations
 
     @classmethod
     def default_company(cls):

Reply via email to