This commit is contained in:
2026-03-03 12:00:35 +01:00
parent 1a9114da7e
commit d9cf6c9a49
3 changed files with 30 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ from trytond.modules.purchase_trade.purchase import (TRIGGERS)
from trytond.transaction import Transaction
from decimal import getcontext, Decimal, ROUND_HALF_UP
from sql import Table
from trytond.pyson import Bool, Eval, Id, If
class PartyExecution(ModelSQL,ModelView):
"Party Execution"
@@ -36,6 +37,23 @@ class PartyExecutionPlace(ModelSQL,ModelView):
pes = fields.Many2One('party.execution.sla',"Sla")
location = fields.Many2One('stock.location',"Location")
cost = fields.Numeric("Cost",digits=(16,4))
mode = fields.Selection([
('lumpsum', 'Lump sum'),
('perqt', 'Per qt'),
('pprice', '% price'),
('rate', '% rate'),
('pcost', '% cost price'),
('ppack', 'Per packing'),
], 'Mode', required=True)
currency = fields.Many2One('currency.currency',"Currency")
unit = fields.Many2One('product.uom',"Unit",domain=[
If(Eval('mode') == 'ppack',
('category', '=', 8),
()),
],
states={
'readonly': Eval('mode') != 'ppack',
})
currency_unit = fields.Selection('get_currency_unit',string="Curr/Unit")
@staticmethod
@@ -74,7 +92,7 @@ class Party(metaclass=PoolMeta):
SlaPlace = Pool().get('party.execution.place')
sp = SlaPlace.search([('pes','=', sla.id),('location','=',location)])
if sp:
return round(((sp[0].cost / Decimal(100)) * Decimal(2.2046)),4)
return round(((sp[0].cost / Decimal(100)) * Decimal(2.2046)),4),sp[0].mode,sp[0].currency,sp[0].unit
def get_alf(self):
if self.name == 'CARGO CONTROL':

View File

@@ -475,11 +475,14 @@ class ShipmentIn(metaclass=PoolMeta):
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])
price,mode,curr,unit = controller.get_sla_cost(self.to_location)
if price and mode and curr and unit:
fee.mode = mode
fee.currency = curr
fee.unit = unit
fee.product = Product.get_by_name('Reweighing')
fee.price = price
Fee.save([fee])
def get_controller(self):
ControllerCategory = Pool().get('party.category')

View File

@@ -1,5 +1,7 @@
<tree>
<field name="location"/>
<field name="mode"/>
<field name="cost"/>
<field name="currency_unit"/>
<field name="currency"/>
<field name="unit"/>
</tree>