20.01.26
This commit is contained in:
@@ -22,3 +22,16 @@ class Party(metaclass=PoolMeta):
|
||||
wb = fields.Many2One('purchase.weight.basis',"Weight basis")
|
||||
association = fields.Many2One('purchase.association',"Association")
|
||||
execution = fields.One2Many('party.execution','party',"")
|
||||
|
||||
@classmethod
|
||||
def getPartyByName(cls, party, category=None):
|
||||
party = party.upper()
|
||||
p = cls.search([('name', '=', party)], limit=1)
|
||||
if p:
|
||||
return p[0].id
|
||||
else:
|
||||
p = cls()
|
||||
p.name = party
|
||||
cls.save([p])
|
||||
return p.id
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user