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
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ class Location(metaclass=PoolMeta):
|
||||
depends=['type'],
|
||||
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()
|
||||
@@ -27,6 +33,18 @@ class Location(metaclass=PoolMeta):
|
||||
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'
|
||||
|
||||
Reference in New Issue
Block a user