Skip to content

Commit

Permalink
[18.0][MIG] product_contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sbejaoui committed Nov 4, 2024
1 parent d8254c8 commit e09e8e6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
10 changes: 5 additions & 5 deletions product_contract/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Recurring - Product Contract
: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
:target: https://github.com/OCA/contract/tree/17.0/product_contract
:target: https://github.com/OCA/contract/tree/18.0/product_contract
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-product_contract
:target: https://translation.odoo-community.org/projects/contract-18-0/contract-18-0-product_contract
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -64,7 +64,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
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
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20product_contract%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20product_contract%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -111,6 +111,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sbejaoui|

This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/17.0/product_contract>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/18.0/product_contract>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion product_contract/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Recurring - Product Contract",
"version": "17.0.2.0.0",
"version": "18.0.1.0.0",
"category": "Contract Management",
"license": "AGPL-3",
"author": "LasLabs, " "ACSONE SA/NV, " "Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion product_contract/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def action_view_sales_orders(self):
orders = self.contract_line_ids.mapped("sale_order_line_id.order_id")
action = {
"name": _("Sales Orders"),
"view_mode": "tree,form",
"view_mode": "list,form",
"res_model": "sale.order",
"type": "ir.actions.act_window",
"domain": [("id", "in", orders.ids)],
Expand Down
4 changes: 2 additions & 2 deletions product_contract/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ProductTemplate(models.Model):
("2", "Second month"),
("3", "Third month"),
],
"Force Month",
"Force Month (quarterly)",
help="Force the month to be used inside the quarter",
)
force_month_semesterly = fields.Selection(
Expand All @@ -125,7 +125,7 @@ class ProductTemplate(models.Model):
("5", "Fifth month"),
("6", "Sixth month"),
],
"Force Month",
"Force Month (semesterly)",
help="Force the month to be used inside the semester",
)

Expand Down
17 changes: 8 additions & 9 deletions product_contract/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _set_contract_line_start_date(self):
forced_month = 0
if line.recurring_rule_type != "monthly":
forced_value = int(
line.product_id["force_month_%s" % line.recurring_rule_type]
line.product_id[f"force_month_{line.recurring_rule_type}"]
)
if forced_value:
# When the selected period is yearly, the period_number field is
Expand All @@ -312,11 +312,10 @@ def _compute_name(self):
res = super()._compute_name()
for line in self:
if line.is_contract:
date_text = ""
if line.contract_start_date_method == "manual":
date_text = "%s" % line.date_start
date_text = f"{line.date_start}"
if line.date_end:
date_text += " -> %s" % line.date_end
date_text += f" -> {line.date_end}"
else:
field_info = dict(
line._fields["contract_start_date_method"].get_description(
Expand All @@ -327,21 +326,21 @@ def _compute_name(self):
start_method_label = field_selection.get(
line.contract_start_date_method
)
date_text = "%s" % start_method_label
date_text = f"{start_method_label}"
if (
line.recurring_rule_type != "monthly"
and line.product_id["force_month_%s" % line.recurring_rule_type]
and line.product_id[f"force_month_{line.recurring_rule_type}"]
):
field_info = dict(
self.env["product.template"]
._fields["force_month_%s" % line.recurring_rule_type]
._fields[f"force_month_{line.recurring_rule_type}"]
.get_description(self.env)
)
field_selection = dict(field_info.get("selection"))
force_month_label = field_selection.get(
line.product_id["force_month_%s" % line.recurring_rule_type]
line.product_id[f"force_month_{line.recurring_rule_type}"]
)
date_text += " (%s)" % force_month_label
date_text += f" ({force_month_label})"
field_info = dict(
self._fields["recurring_rule_type"].get_description(self.env)
)
Expand Down
6 changes: 3 additions & 3 deletions product_contract/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Recurring - Product Contract</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5fad83840670bd8d7d46dccef1979e7402bd2e1954e77a5250290b43c9a989b0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/product_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-product_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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/18.0/product_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-18-0/contract-18-0-product_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=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds support for products to be linked to contract
templates.</p>
<p>A contract is created on <tt class="docutils literal">sale.order</tt> confirmation for each different
Expand Down Expand Up @@ -412,7 +412,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">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:%20product_contract%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20product_contract%0Aversion:%2018.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">
Expand Down Expand Up @@ -449,7 +449,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/sbejaoui"><img alt="sbejaoui" src="https://github.com/sbejaoui.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/17.0/product_contract">OCA/contract</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/18.0/product_contract">OCA/contract</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion product_contract/views/sale_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</group>
</xpath>
<xpath
expr="//field[@name='order_line']/tree//field[@name='price_total']"
expr="//field[@name='order_line']/list//field[@name='price_total']"
position="after"
>
<field name="contract_template_id" column_invisible="1" />
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
python-dateutil

0 comments on commit e09e8e6

Please sign in to comment.