03.03.26
This commit is contained in:
@@ -5,6 +5,7 @@ from trytond.modules.purchase_trade.purchase import (TRIGGERS)
|
|||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from decimal import getcontext, Decimal, ROUND_HALF_UP
|
from decimal import getcontext, Decimal, ROUND_HALF_UP
|
||||||
from sql import Table
|
from sql import Table
|
||||||
|
from trytond.pyson import Bool, Eval, Id, If
|
||||||
|
|
||||||
class PartyExecution(ModelSQL,ModelView):
|
class PartyExecution(ModelSQL,ModelView):
|
||||||
"Party Execution"
|
"Party Execution"
|
||||||
@@ -36,6 +37,23 @@ class PartyExecutionPlace(ModelSQL,ModelView):
|
|||||||
pes = fields.Many2One('party.execution.sla',"Sla")
|
pes = fields.Many2One('party.execution.sla',"Sla")
|
||||||
location = fields.Many2One('stock.location',"Location")
|
location = fields.Many2One('stock.location',"Location")
|
||||||
cost = fields.Numeric("Cost",digits=(16,4))
|
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")
|
currency_unit = fields.Selection('get_currency_unit',string="Curr/Unit")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -74,7 +92,7 @@ class Party(metaclass=PoolMeta):
|
|||||||
SlaPlace = Pool().get('party.execution.place')
|
SlaPlace = Pool().get('party.execution.place')
|
||||||
sp = SlaPlace.search([('pes','=', sla.id),('location','=',location)])
|
sp = SlaPlace.search([('pes','=', sla.id),('location','=',location)])
|
||||||
if sp:
|
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):
|
def get_alf(self):
|
||||||
if self.name == 'CARGO CONTROL':
|
if self.name == 'CARGO CONTROL':
|
||||||
|
|||||||
@@ -475,11 +475,14 @@ class ShipmentIn(metaclass=PoolMeta):
|
|||||||
fee.supplier = controller
|
fee.supplier = controller
|
||||||
fee.type = 'budgeted'
|
fee.type = 'budgeted'
|
||||||
fee.p_r = 'pay'
|
fee.p_r = 'pay'
|
||||||
fee.mode = 'perqt'
|
price,mode,curr,unit = controller.get_sla_cost(self.to_location)
|
||||||
fee.currency = 1
|
if price and mode and curr and unit:
|
||||||
fee.product = Product.get_by_name('Reweighing')
|
fee.mode = mode
|
||||||
fee.price = controller.get_sla_cost(self.to_location)
|
fee.currency = curr
|
||||||
Fee.save([fee])
|
fee.unit = unit
|
||||||
|
fee.product = Product.get_by_name('Reweighing')
|
||||||
|
fee.price = price
|
||||||
|
Fee.save([fee])
|
||||||
|
|
||||||
def get_controller(self):
|
def get_controller(self):
|
||||||
ControllerCategory = Pool().get('party.category')
|
ControllerCategory = Pool().get('party.category')
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<tree>
|
<tree>
|
||||||
<field name="location"/>
|
<field name="location"/>
|
||||||
|
<field name="mode"/>
|
||||||
<field name="cost"/>
|
<field name="cost"/>
|
||||||
<field name="currency_unit"/>
|
<field name="currency"/>
|
||||||
|
<field name="unit"/>
|
||||||
</tree>
|
</tree>
|
||||||
Reference in New Issue
Block a user