Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions contract/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

================================
Recurring - Contracts Management
================================
Expand All @@ -17,7 +13,7 @@ Recurring - Contracts Management
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
Expand Down Expand Up @@ -75,6 +71,9 @@ Usage
- #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
- #START-NEXT-MONTH# or #END-NEXT-MONTH# to display next month's
dates based on the invoice period start, useful when invoicing the
next month's services
- pre-paid (invoice at period start) or post-paid (invoice at start
of next period)

Expand Down
12 changes: 12 additions & 0 deletions contract/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,18 @@ def _insert_markers(self, first_date_invoiced, last_date_invoiced):
name = self.name
name = name.replace("#START#", first_date_invoiced.strftime(date_format))
name = name.replace("#END#", last_date_invoiced.strftime(date_format))
name = name.replace(
"#START-NEXT-MONTH#",
(first_date_invoiced + relativedelta(months=1, day=1)).strftime(
date_format
),
)
name = name.replace(
"#END-NEXT-MONTH#",
(first_date_invoiced + relativedelta(months=1, day=31)).strftime(
date_format
),
)
name = name.replace(
"#INVOICEMONTHNAME#",
self.with_context(lang=lang.code)._translate_marker_month_name(
Expand Down
3 changes: 3 additions & 0 deletions contract/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- \#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
- \#START-NEXT-MONTH\# or \#END-NEXT-MONTH\# to display next month's
dates based on the invoice period start, useful when invoicing the
next month's services
- 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
Expand Down
33 changes: 15 additions & 18 deletions contract/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Recurring - Contracts Management</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="recurring-contracts-management">
<h1 class="title">Recurring - Contracts Management</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="recurring-contracts-management">
<h1>Recurring - Contracts Management</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ca0e30699a36292fd87dcaf6095f1bbf7b7c370e27f9710334eb999511fed762
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/17.0/contract"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-contract"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/17.0/contract"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-contract"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module enables contracts management with recurring invoicing
functions. Also you can print and send by email contract report.</p>
<p>It works for customer contract and supplier contracts.</p>
Expand All @@ -395,14 +390,14 @@ <h1>Recurring - Contracts Management</h1>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To view discount field in contract line, you need to set <em>Discount on
lines</em> in user access rights.</p>
<p>Contracts can be viewed on the portal (list and detail) if the user
logged into the portal is a follower of the contract.</p>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ol class="arabic simple">
<li>Contracts are in Invoicing -&gt; Customers -&gt; Customer and Invoicing -&gt;
Vendors -&gt; Supplier Contracts</li>
Expand All @@ -422,6 +417,9 @@ <h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<li>#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</li>
<li>#START-NEXT-MONTH# or #END-NEXT-MONTH# to display next month’s
dates based on the invoice period start, useful when invoicing the
next month’s services</li>
<li>pre-paid (invoice at period start) or post-paid (invoice at start
of next period)</li>
</ul>
Expand All @@ -446,31 +444,31 @@ <h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/contract/17.0/contract/static/src/screenshots/portal-detail.png" /></p>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Recover states and others functional fields in Contracts.</li>
<li>Add recurrence flag at template level.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-5">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-6">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<ul>
<li><p class="first">Angel Moya &lt;<a class="reference external" href="mailto:angel.moya&#64;domatix.com">angel.moya&#64;domatix.com</a>&gt;</p>
</li>
Expand Down Expand Up @@ -509,7 +507,7 @@ <h3><a class="toc-backref" href="#toc-entry-7">Contributors</a></h3>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -522,6 +520,5 @@ <h3><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
9 changes: 9 additions & 0 deletions contract/tests/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ def setUpClass(cls):
"price_unit": 120,
},
),
(
0,
0,
{
"name": "#START-NEXT-MONTH# - #END-NEXT-MONTH#",
"display_type": "line_note",
},
),
],
}
)
Expand Down Expand Up @@ -2403,6 +2411,7 @@ def test_check_month_name_marker(self):
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")
self.assertEqual(invoice_id.invoice_line_ids[3].name, "06/01/2023 - 06/30/2023")

def test_analytic_account(self):
"""Tests the automatic setting of the analytic account on the contract
Expand Down
14 changes: 14 additions & 0 deletions contract/views/contract.xml
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,20 @@
the
invoiced period
</p>
<p colspan="2">
<strong>#START-NEXT-MONTH#</strong>
: Start
date
of the
next month
</p>
<p colspan="2">
<strong>#END-NEXT-MONTH#</strong>
: End date
of
the
next month
</p>
<p colspan="2">
<strong>#INVOICEMONTHNAME#</strong>
: Invoice month name
Expand Down
Loading