This commit is contained in:
2026-01-20 11:04:53 +01:00
parent c39bb1d6d1
commit a479dc718b
7 changed files with 199 additions and 11 deletions

View File

@@ -24,16 +24,21 @@ class Location(metaclass=PoolMeta):
__name__ = 'stock.location'
@classmethod
def get_transit_id(cls):
transit = cls.search([('name', '=', 'Transit')], limit=1)
if transit:
return transit[0].id
def getLocationByName(cls, location, type):
location = location.upper()
loc = cls.search([('name', '=', location),('type', '=', type)], limit=1)
if loc:
return loc[0].id
else:
transit = cls()
transit.name = 'Transit'
transit.type = 'storage'
cls.save([transit])
return transit.id
loc = cls()
loc.name = location
loc.type = type
cls.save([loc])
return loc.id
@classmethod
def get_transit_id(cls):
return cls.getLocationByName('TRANSIT','storage')
def is_transit(self):
if self.name == 'Transit':