diff --git a/contract/README.rst b/contract/README.rst
index 635369116..14f423db8 100644
--- a/contract/README.rst
+++ b/contract/README.rst
@@ -57,21 +57,22 @@ Usage
2. When creating a contract, fill fields for selecting the invoicing
parameters:
- - a journal
- - a price list (optional)
+ - a journal
+ - a price list (optional)
3. And add the lines to be invoiced with:
- - the product with a description, a quantity and a price
- - the recurrence parameters: interval (days, weeks, months, months
- last day or years), start date, date of next invoice (automatically
- computed, can be modified) and end date (optional)
- - auto-price, for having a price automatically obtained from the
- price list
- - #START# or #END# in the description field to display the start/end
- date of the invoiced period in the invoice line description
- - pre-paid (invoice at period start) or post-paid (invoice at start
- of next period)
+ - the product with a description, a quantity and a price
+ - the recurrence parameters: interval (days, weeks, months, months
+ last day or years), start date, date of next invoice
+ (automatically computed, can be modified) and end date (optional)
+ - auto-price, for having a price automatically obtained from the
+ price list
+ - #START# - #END# or #INVOICEMONTHNAME# in the description field to
+ display the start/end date or the start month of the invoiced
+ period in the invoice line description
+ - pre-paid (invoice at period start) or post-paid (invoice at start
+ of next period)
4. The "Generate Recurring Invoices from Contracts" cron runs daily to
generate the invoices. If you are in debug mode, you can click on the
@@ -85,7 +86,7 @@ Usage
price list and lines when creating a contract. To use it, just select
the template on the contract and fields will be filled automatically.
-- Contracts appear in portal to following users in every contract:
+- Contracts appear in portal to following users in every contract:
|image|
@@ -100,8 +101,8 @@ Usage
Known issues / Roadmap
======================
-- Recover states and others functional fields in Contracts.
-- Add recurrence flag at template level.
+- Recover states and others functional fields in Contracts.
+- Add recurrence flag at template level.
Bug Tracker
===========
@@ -125,33 +126,33 @@ Authors
Contributors
------------
-- Angel Moya
diff --git a/contract/tests/test_contract.py b/contract/tests/test_contract.py
index 77e8f5c2a..4a7ddb48b 100644
--- a/contract/tests/test_contract.py
+++ b/contract/tests/test_contract.py
@@ -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")
diff --git a/contract/views/contract.xml b/contract/views/contract.xml
index eae34394e..d2ac27cc3 100644
--- a/contract/views/contract.xml
+++ b/contract/views/contract.xml
@@ -478,6 +478,13 @@
the
invoiced period
+ #INVOICEMONTHNAME# + : Invoice month name + of + the + invoiced period +
diff --git a/contract/views/contract_template.xml b/contract/views/contract_template.xml index 8e9bf9451..f93ca395e 100644 --- a/contract/views/contract_template.xml +++ b/contract/views/contract_template.xml @@ -76,6 +76,8 @@#START#: Start date of the invoiced period
#END#: End date of the invoiced period
+#INVOICEMONTHNAME#: Invoice month name of the invoiced period