From 67cb5491e2ca8f8560cfda4254772f210f6db81a Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Tue, 9 Jun 2026 13:30:24 +0200 Subject: [PATCH] Melya template --- modules/account_invoice/invoice_melya.fodt | 5 ++--- modules/purchase_trade/invoice.py | 16 ++++++++++++++++ modules/purchase_trade/purchase.py | 6 ++++++ modules/purchase_trade/sale.py | 6 ++++++ modules/purchase_trade/tests/test_module.py | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/modules/account_invoice/invoice_melya.fodt b/modules/account_invoice/invoice_melya.fodt index 81a37e9..ac42534 100644 --- a/modules/account_invoice/invoice_melya.fodt +++ b/modules/account_invoice/invoice_melya.fodt @@ -1623,13 +1623,12 @@ <invoice.report_payment_description or ''>  <if test="invoice.report_melya_maturity_date">Maturity date: <format_date(invoice.report_melya_maturity_date, invoice.party.lang)></if> - <if test="invoice.report_melya_bank_name">Bank: <invoice.report_melya_bank_name></if> + <invoice.report_melya_bank_details_line> <for each="line in invoice.report_melya_bank_address.splitlines()"> <line> </for> - <if test="invoice.report_melya_bank_iban">IBAN : <invoice.report_melya_bank_iban></if> - <if test="invoice.report_melya_bank_swift">SwifT Code: <invoice.report_melya_bank_swift></if> + <invoice.report_melya_bank_account_line> diff --git a/modules/purchase_trade/invoice.py b/modules/purchase_trade/invoice.py index debe7a7..df0ab99 100644 --- a/modules/purchase_trade/invoice.py +++ b/modules/purchase_trade/invoice.py @@ -849,6 +849,22 @@ class Invoice(metaclass=PoolMeta): return self._get_report_bank_swift( self._get_report_melya_bank_account()) + @property + def report_melya_bank_details_line(self): + name = self.report_melya_bank_name + return 'BANK DETAILS:\t\t%s' % name if name else '' + + @property + def report_melya_bank_account_line(self): + parts = [] + iban = self.report_melya_bank_iban + swift = self.report_melya_bank_swift + if iban: + parts.append('IBAN : %s' % iban) + if swift: + parts.append('Swift Code: %s' % swift) + return ', '.join(parts) + @property def report_melya_maturity_date(self): maturity_dates = [ diff --git a/modules/purchase_trade/purchase.py b/modules/purchase_trade/purchase.py index 5156e7c..ddfa251 100755 --- a/modules/purchase_trade/purchase.py +++ b/modules/purchase_trade/purchase.py @@ -264,6 +264,12 @@ class PurchaseCrop(ModelSQL,ModelView): class Purchase(metaclass=PoolMeta): __name__ = 'purchase.purchase' + @classmethod + @ModelView.button + def confirm(cls, purchases): + # Confirm is disabled in Trad'ON; keep the record in quotation. + pass + btb = fields.Many2One('back.to.back',"Back to back") charter_conditions = fields.One2Many( 'charter.condition', 'purchase', "Charter Conditions") diff --git a/modules/purchase_trade/sale.py b/modules/purchase_trade/sale.py index d35e60b..fbee101 100755 --- a/modules/purchase_trade/sale.py +++ b/modules/purchase_trade/sale.py @@ -229,6 +229,12 @@ class Lot(metaclass=PoolMeta): class Sale(metaclass=PoolMeta): __name__ = 'sale.sale' + @classmethod + @ModelView.button + def confirm(cls, sales): + # Confirm is disabled in Trad'ON; keep the record in quotation. + pass + btb = fields.Many2One('back.to.back',"Back to back") charter_conditions = fields.One2Many( 'charter.condition', 'sale', "Charter Conditions") diff --git a/modules/purchase_trade/tests/test_module.py b/modules/purchase_trade/tests/test_module.py index 78faab2..6fd7cc1 100644 --- a/modules/purchase_trade/tests/test_module.py +++ b/modules/purchase_trade/tests/test_module.py @@ -4458,6 +4458,12 @@ class PurchaseTradeTestCase(ModuleTestCase): invoice.report_melya_bank_iban, 'CH36 0021 5215 2487 7461 D') self.assertEqual(invoice.report_melya_bank_swift, 'UBSWCHZH80A') + self.assertEqual( + invoice.report_melya_bank_details_line, + 'BANK DETAILS:\t\tUBS SWITZERLAND AG') + self.assertEqual( + invoice.report_melya_bank_account_line, + 'IBAN : CH36 0021 5215 2487 7461 D, Swift Code: UBSWCHZH80A') def test_invoice_melya_maturity_date_uses_lines_to_pay(self): 'invoice_melya maturity date uses the earliest line to pay maturity'