Add maturity date
This commit is contained in:
@@ -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