From 779e1aa361aaa72303a602cfe67f9eb11f5513e5 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Sun, 31 May 2026 22:07:57 +0200 Subject: [PATCH] Charter party --- modules/purchase_trade/stock.py | 22 ++++++++++++++-------- modules/purchase_trade/view/sof_form.xml | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/purchase_trade/stock.py b/modules/purchase_trade/stock.py index e4a5dec..288218d 100755 --- a/modules/purchase_trade/stock.py +++ b/modules/purchase_trade/stock.py @@ -1876,10 +1876,11 @@ class StatementOfFacts(ModelSQL, ModelView): demurrage_rate_o = fields.Numeric('Demurrage Rate ($/day)', digits=(16, 2)) pumping_rate_o = fields.Float('Pumping Rate (MT/hour)') - timebar_day = fields.Integer("TimeBar") - timebar_warn = fields.Integer("Warning TimeBar") - chart = fields.Many2One('document.incoming',"Charter Party Terms") - sof = fields.Many2One('document.incoming',"Statement of facts") + timebar_day = fields.Integer("TimeBar") + timebar_warn = fields.Integer("Warning TimeBar") + charter_party = fields.Many2One('stock.charter.party', "Charter Party") + chart = fields.Many2One('document.incoming',"Charter Party Terms") + sof = fields.Many2One('document.incoming',"Statement of facts") # === B. Événements du SOF === sof_events = fields.One2Many('sof.event', 'statement', "SOF Events") @@ -1904,10 +1905,15 @@ class StatementOfFacts(ModelSQL, ModelView): (None, 'No Compensation'), ], 'Compensation Type') compensation_amount = fields.Numeric('Compensation Amount ($)', readonly=True, digits=(16, 2)) - quantity = fields.Function(fields.Float("Quantity loaded"),'get_qt') - - notes = fields.Text('Remarks / Notes') - + quantity = fields.Function(fields.Float("Quantity loaded"),'get_qt') + + notes = fields.Text('Remarks / Notes') + + @fields.depends('shipment', 'charter_party') + def on_change_shipment(self): + if self.shipment and self.shipment.charter_party and not self.charter_party: + self.charter_party = self.shipment.charter_party + def get_qt(self,name): if self.shipment: return self.shipment.get_quantity() diff --git a/modules/purchase_trade/view/sof_form.xml b/modules/purchase_trade/view/sof_form.xml index 7c35bad..22eb0d5 100755 --- a/modules/purchase_trade/view/sof_form.xml +++ b/modules/purchase_trade/view/sof_form.xml @@ -3,8 +3,8 @@ -