mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] Add INVOICEMONTHNAME marker to line description
[FIX] contract: Set fixed date to check test correctly. We need to set a fixed date for teststest_check_month_name_marker to check against the month of the date we are set (otherwise it would check against the month of today).
This commit is contained in:
@@ -8,6 +8,7 @@ from collections import namedtuple
|
||||
from datetime import timedelta
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from freezegun import freeze_time
|
||||
|
||||
from odoo import fields
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
@@ -141,7 +142,7 @@ class TestContractBase(common.TransactionCase):
|
||||
0,
|
||||
{
|
||||
"product_id": False,
|
||||
"name": "Header for Services",
|
||||
"name": "Header for #INVOICEMONTHNAME# Services",
|
||||
"display_type": "line_section",
|
||||
},
|
||||
),
|
||||
@@ -2385,3 +2386,11 @@ class TestContract(TestContractBase):
|
||||
self.assertEqual(len(self.contract._get_related_invoices()), 4)
|
||||
self.contract.recurring_create_invoice()
|
||||
self.assertEqual(len(self.contract._get_related_invoices()), 4)
|
||||
|
||||
@freeze_time("2023-05-01")
|
||||
def test_check_month_name_marker(self):
|
||||
"""Set fixed date to check test correctly."""
|
||||
self.contract3.contract_line_ids.date_start = fields.Date.today()
|
||||
self.contract3.contract_line_ids.recurring_next_date = fields.Date.today()
|
||||
invoice_id = self.contract3.recurring_create_invoice()
|
||||
self.assertEqual(invoice_id.invoice_line_ids[0].name, "Header for May Services")
|
||||
|
||||
Reference in New Issue
Block a user