changeset 6d173cf288b3 in modules/stock_consignment:default
details:
https://hg.tryton.org/modules/stock_consignment?cmd=changeset;node=6d173cf288b3
description:
Define lost and found location for inventory on parent location
We remove the lost and found location on the inventory to only used one
define
on the warehouse or parent of the inventoried location.
issue9071
review276901002
diffstat:
CHANGELOG | 2 ++
stock.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r b29f81efa79a -r 6d173cf288b3 CHANGELOG
--- a/CHANGELOG Sun Mar 01 16:12:40 2020 +0100
+++ b/CHANGELOG Tue Mar 17 23:35:47 2020 +0100
@@ -1,3 +1,5 @@
+* Add lost and found per supplier and customer location
+
Version 5.4.0 - 2019-11-04
* Bug fixes (see mercurial logs for details)
diff -r b29f81efa79a -r 6d173cf288b3 stock.py
--- a/stock.py Sun Mar 01 16:12:40 2020 +0100
+++ b/stock.py Tue Mar 17 23:35:47 2020 +0100
@@ -21,12 +21,30 @@
help="The party invoiced when consignment stock is used.")
@classmethod
+ def __setup__(cls):
+ super().__setup__()
+ cls.lost_found_location.states['invisible'] &= (
+ ~Eval('type').in_(['supplier', 'customer']))
+
+ @classmethod
def _parent_domain(cls):
domain = super(Location, cls)._parent_domain()
domain['supplier'].append('storage')
domain['storage'].append('customer')
return domain
+ @property
+ def lost_found_used(self):
+ lost_found = super().lost_found_used
+ if not lost_found and not self.warehouse and self.type == 'storage':
+ location = self.parent
+ while location:
+ if location.type in {'supplier', 'storage'}:
+ lost_found = location.lost_found_location
+ break
+ location = location.parent
+ return lost_found
+
class LocationLeadTime(metaclass=PoolMeta):
__name__ = 'stock.location.lead_time'