Fee rules
This commit is contained in:
@@ -993,7 +993,7 @@ class FeeRule(ModelSQL, ModelView):
|
||||
|
||||
party = fields.Many2One('party.party', "Counterparty")
|
||||
line_product = fields.Many2One('product.product', "Line Product")
|
||||
incoterm = fields.Many2One('incoterm.incoterm', "Incoterm")
|
||||
incoterm_code = fields.Char("Incoterm Code")
|
||||
from_location = fields.Many2One('stock.location', "From Location")
|
||||
to_location = fields.Many2One('stock.location', "To Location")
|
||||
execution_plan = fields.Many2One('workflow.plan', "Execution Plan")
|
||||
@@ -1071,13 +1071,17 @@ class FeeRule(ModelSQL, ModelView):
|
||||
checks = [
|
||||
(self.party, getattr(contract, 'party', None)),
|
||||
(self.line_product, getattr(line, 'product', None)),
|
||||
(self.incoterm, getattr(contract, 'incoterm', None)),
|
||||
(self.from_location, getattr(contract, 'from_location', None)),
|
||||
(self.to_location, getattr(contract, 'to_location', None)),
|
||||
]
|
||||
if any(rule_value and not self._same_record(rule_value, actual)
|
||||
for rule_value, actual in checks):
|
||||
return False
|
||||
if self.incoterm_code:
|
||||
incoterm = getattr(contract, 'incoterm', None)
|
||||
if (getattr(incoterm, 'code', '') or '').upper() != (
|
||||
self.incoterm_code or '').upper():
|
||||
return False
|
||||
if self.execution_plan and not self._same_record(
|
||||
self.execution_plan, getattr(contract, 'plan', None)):
|
||||
return False
|
||||
|
||||
@@ -1804,7 +1804,8 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
rule.apply_on = 'purchase_line'
|
||||
rule.party = party
|
||||
rule.line_product = product
|
||||
rule.incoterm = incoterm
|
||||
rule.incoterm_code = 'FOB'
|
||||
incoterm.code = 'FOB'
|
||||
rule.from_location = from_location
|
||||
rule.to_location = to_location
|
||||
rule.execution_plan = plan
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<field name="party"/>
|
||||
<label name="line_product"/>
|
||||
<field name="line_product"/>
|
||||
<label name="incoterm"/>
|
||||
<field name="incoterm"/>
|
||||
<label name="incoterm_code"/>
|
||||
<field name="incoterm_code"/>
|
||||
<label name="from_location"/>
|
||||
<field name="from_location"/>
|
||||
<label name="to_location"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="auto_apply"/>
|
||||
<field name="party"/>
|
||||
<field name="line_product"/>
|
||||
<field name="incoterm"/>
|
||||
<field name="incoterm_code"/>
|
||||
<field name="from_location"/>
|
||||
<field name="to_location"/>
|
||||
<field name="fee_product"/>
|
||||
|
||||
Reference in New Issue
Block a user