Add counter to controller
This commit is contained in:
@@ -487,16 +487,26 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
fee.price = price
|
||||
Fee.save([fee])
|
||||
|
||||
def get_controller(self):
|
||||
ControllerCategory = Pool().get('party.category')
|
||||
PartyCategory = Pool().get('party.party-party.category')
|
||||
cc = ControllerCategory.search(['name','=','CONTROLLER'])
|
||||
if cc:
|
||||
cc = cc[0]
|
||||
controllers = PartyCategory.search(['category','=',cc.id])
|
||||
for c in controllers:
|
||||
if c.party.IsAvailableForControl(self):
|
||||
return c.party
|
||||
def get_controller(self):
|
||||
ControllerCategory = Pool().get('party.category')
|
||||
PartyCategory = Pool().get('party.party-party.category')
|
||||
cc = ControllerCategory.search(['name','=','CONTROLLER'])
|
||||
if cc:
|
||||
cc = cc[0]
|
||||
controllers = PartyCategory.search(['category','=',cc.id])
|
||||
prioritized = []
|
||||
for c in controllers:
|
||||
if not c.party.IsAvailableForControl(self):
|
||||
continue
|
||||
gap, rule = c.party.get_controller_execution_priority(self)
|
||||
prioritized.append((
|
||||
1 if rule else 0,
|
||||
gap if gap is not None else Decimal('-999999'),
|
||||
c.party,
|
||||
))
|
||||
if prioritized:
|
||||
prioritized.sort(key=lambda item: (item[0], item[1]), reverse=True)
|
||||
return prioritized[0][2]
|
||||
|
||||
def get_instructions_html(self,inv_date,inv_nb):
|
||||
vessel = self.vessel.vessel_name if self.vessel else ""
|
||||
|
||||
Reference in New Issue
Block a user