From 91bf2a3de4c0425084211b38ed4ce8dfac043a93 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 31 May 2026 23:39:07 +0200 Subject: [PATCH] Contract clauses --- modules/purchase_trade/purchase.py | 16 ++++++++-------- .../purchase_trade/view/contract_clause_form.xml | 4 ++-- .../purchase_trade/view/contract_clause_tree.xml | 2 +- .../view/contract_template_form.xml | 4 ++-- .../view/contract_template_tree.xml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/purchase_trade/purchase.py b/modules/purchase_trade/purchase.py index 97dd076..e71cca7 100755 --- a/modules/purchase_trade/purchase.py +++ b/modules/purchase_trade/purchase.py @@ -859,7 +859,7 @@ class ContractClause(ModelSQL, ModelView): language = fields.Char("Language") source = fields.Char("Source") text = fields.Text("Text", required=True) - incoterm = fields.Many2One('incoterm.incoterm', "Incoterm") + incoterm_code = fields.Char("Incoterm") product = fields.Many2One('product.product', "Product") payment_term = fields.Many2One( 'account.invoice.payment_term', "Payment Term") @@ -893,9 +893,9 @@ class ContractClause(ModelSQL, ModelView): def matches_contract(self, contract, direction): if self.direction not in ('both', direction): return False - if (self.incoterm - and getattr(getattr(contract, 'incoterm', None), 'id', None) - != self.incoterm.id): + if (self.incoterm_code + and getattr(getattr(contract, 'incoterm', None), 'code', None) + != self.incoterm_code): return False if (self.payment_term and getattr(getattr(contract, 'payment_term', None), 'id', None) @@ -929,7 +929,7 @@ class ContractTemplate(ModelSQL, ModelView): ('sale', 'Sale'), ], "Direction", required=True) active = fields.Boolean("Active") - incoterm = fields.Many2One('incoterm.incoterm', "Incoterm") + incoterm_code = fields.Char("Incoterm") product = fields.Many2One('product.product', "Product") payment_term = fields.Many2One( 'account.invoice.payment_term', "Payment Term") @@ -959,9 +959,9 @@ class ContractTemplate(ModelSQL, ModelView): def matches_contract(self, contract, direction): if self.direction not in ('both', direction): return False - if (self.incoterm - and getattr(getattr(contract, 'incoterm', None), 'id', None) - != self.incoterm.id): + if (self.incoterm_code + and getattr(getattr(contract, 'incoterm', None), 'code', None) + != self.incoterm_code): return False if (self.payment_term and getattr(getattr(contract, 'payment_term', None), 'id', None) diff --git a/modules/purchase_trade/view/contract_clause_form.xml b/modules/purchase_trade/view/contract_clause_form.xml index 7dc0b6a..cd64223 100644 --- a/modules/purchase_trade/view/contract_clause_form.xml +++ b/modules/purchase_trade/view/contract_clause_form.xml @@ -15,8 +15,8 @@