Add maturity date

This commit is contained in:
2026-05-28 13:59:36 +02:00
parent 1af7ae99a4
commit c9028f1590
3 changed files with 24 additions and 0 deletions

View File

@@ -1583,6 +1583,7 @@
<table:table-cell table:style-name="Tableau1.A1" office:value-type="string">
<text:p text:style-name="P8"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T6">Payment terms:</text:span></text:span></text:p>
<text:p text:style-name="P8"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T9"><text:placeholder text:placeholder-type="text">&lt;invoice.report_payment_description or &apos;&apos;&gt;</text:placeholder></text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T9"> </text:span></text:span></text:p>
<text:p text:style-name="P8"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.report_melya_maturity_date&quot;&gt;</text:placeholder><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T6">Maturity date: </text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T9"><text:placeholder text:placeholder-type="text">&lt;format_date(invoice.report_melya_maturity_date, invoice.party.lang)&gt;</text:placeholder></text:span></text:span><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P4"/>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.report_melya_bank_name&quot;&gt;</text:placeholder>Bank: <text:placeholder text:placeholder-type="text">&lt;invoice.report_melya_bank_name&gt;</text:placeholder><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P8"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.report_melya_bank_address.splitlines()&quot;&gt;</text:placeholder></text:p>

View File

@@ -712,6 +712,14 @@ class Invoice(metaclass=PoolMeta):
return self._get_report_bank_swift(
self._get_report_melya_bank_account())
@property
def report_melya_maturity_date(self):
maturity_dates = [
line.maturity_date for line in (self.lines_to_pay or [])
if getattr(line, 'maturity_date', None)]
if maturity_dates:
return min(maturity_dates)
@property
def _report_payment_order_company_account(self):
return self._get_report_bank_account(getattr(self.company, 'party', None))

View File

@@ -3293,6 +3293,21 @@ class PurchaseTradeTestCase(ModuleTestCase):
'CH36 0021 5215 2487 7461 D')
self.assertEqual(invoice.report_melya_bank_swift, 'UBSWCHZH80A')
def test_invoice_melya_maturity_date_uses_lines_to_pay(self):
'invoice_melya maturity date uses the earliest line to pay maturity'
Invoice = Pool().get('account.invoice')
invoice = Invoice()
invoice.lines_to_pay = [
Mock(maturity_date=datetime.date(2026, 9, 9)),
Mock(maturity_date=datetime.date(2026, 8, 9)),
Mock(maturity_date=None),
]
self.assertEqual(
invoice.report_melya_maturity_date,
datetime.date(2026, 8, 9))
def test_sale_report_deal_uses_purchase_and_sale_numbers(self):
'sale deal number includes the linked purchase number'
Sale = Pool().get('sale.sale')