Add maturity date
This commit is contained in:
@@ -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"><invoice.report_payment_description or ''></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"><if test="invoice.report_melya_maturity_date"></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"><format_date(invoice.report_melya_maturity_date, invoice.party.lang)></text:placeholder></text:span></text:span><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<text:p text:style-name="P4"/>
|
||||
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text"><if test="invoice.report_melya_bank_name"></text:placeholder>Bank: <text:placeholder text:placeholder-type="text"><invoice.report_melya_bank_name></text:placeholder><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<text:p text:style-name="P8"><text:placeholder text:placeholder-type="text"><for each="line in invoice.report_melya_bank_address.splitlines()"></text:placeholder></text:p>
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user