This commit is contained in:
2026-02-03 15:43:38 +01:00
parent 39e59b5b8b
commit 99d895c951
3 changed files with 23 additions and 0 deletions

View File

@@ -310,6 +310,7 @@ class AutomationCron(ModelSQL, ModelView):
ShipmentIn.save([shipment])
inv_date,inv_nb = shipment._create_lots_from_fintrade()
shipment.controller = shipment.get_controller()
shipment.create_fee(shipment.controller)
shipment.instructions = shipment.get_instructions_html(inv_date,inv_nb)
ShipmentIn.save([shipment])
trans_shipment.commit()

View File

@@ -66,6 +66,14 @@ class Party(metaclass=PoolMeta):
def IsAvailableForControl(self,sh):
return True
def get_sla_cost(self,location):
if self.sla:
for sla in self.sla:
SlaPlace = Pool().get('party.execution.place')
sp = SlaPlace.search([('pes','=', sla.id),('location','=',location)])
if sp:
return round(((sp[0].cost / 100) * 2204,62262),4)
@classmethod
def getPartyByName(cls, party, category=None):
party = party.upper()

View File

@@ -455,6 +455,20 @@ class ShipmentIn(metaclass=PoolMeta):
else:
return str(self.id)
def create_fee(self,controller):
Fee = Pool().get('fee.fee')
Product = Pool().get('product.product')
fee = Fee()
fee.shipment_in = self.id
fee.supplier = controller
fee.type = 'budgeted'
fee.p_r = 'pay'
fee.mode = 'perqt'
fee.currency = 1
fee.product = Product.get_by_name('Reweighing')
fee.price = controller.get_sla_cost(self.to_location)
Fee.save([fee])
def get_controller(self):
ControllerCategory = Pool().get('party.category')
PartyCategory = Pool().get('party.party-party.category')