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':