From fd938b6fa8ccc1b142ee8c4faead353b08ee59d6 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 4 Nov 2024 15:08:50 +0100 Subject: [PATCH] [18.0][MIG] product_contract --- product_contract/README.rst | 10 +++++----- product_contract/__manifest__.py | 4 ++-- product_contract/models/contract.py | 2 +- product_contract/models/product_template.py | 4 ++-- product_contract/models/sale_order_line.py | 17 ++++++++--------- product_contract/static/description/index.html | 6 +++--- product_contract/views/sale_order.xml | 2 +- requirements.txt | 2 ++ 8 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 requirements.txt diff --git a/product_contract/README.rst b/product_contract/README.rst index e9f75bda91..e78ea3cc60 100644 --- a/product_contract/README.rst +++ b/product_contract/README.rst @@ -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| @@ -64,7 +64,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -111,6 +111,6 @@ Current `maintainer `__: |maintainer-sbejaoui| -This module is part of the `OCA/contract `_ project on GitHub. +This module is part of the `OCA/contract `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/product_contract/__manifest__.py b/product_contract/__manifest__.py index 135cdacae4..49f123140d 100644 --- a/product_contract/__manifest__.py +++ b/product_contract/__manifest__.py @@ -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)", @@ -20,7 +20,7 @@ ], "installable": True, "application": False, - "external_dependencies": {"python": ["dateutil"]}, + "external_dependencies": {"python": ["python-dateutil"]}, "maintainers": ["sbejaoui"], "assets": {"web.assets_backend": ["product_contract/static/src/js/*"]}, } diff --git a/product_contract/models/contract.py b/product_contract/models/contract.py index d37752ef2e..2e003e2b5b 100644 --- a/product_contract/models/contract.py +++ b/product_contract/models/contract.py @@ -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)], diff --git a/product_contract/models/product_template.py b/product_contract/models/product_template.py index 9c899adfbe..12a0bd9169 100644 --- a/product_contract/models/product_template.py +++ b/product_contract/models/product_template.py @@ -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( @@ -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", ) diff --git a/product_contract/models/sale_order_line.py b/product_contract/models/sale_order_line.py index fa86047c89..96d5ebdaa8 100644 --- a/product_contract/models/sale_order_line.py +++ b/product_contract/models/sale_order_line.py @@ -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 @@ -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( @@ -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) ) diff --git a/product_contract/static/description/index.html b/product_contract/static/description/index.html index 9dfa5c9ec0..206d54736e 100644 --- a/product_contract/static/description/index.html +++ b/product_contract/static/description/index.html @@ -369,7 +369,7 @@

Recurring - Product Contract

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:5fad83840670bd8d7d46dccef1979e7402bd2e1954e77a5250290b43c9a989b0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runboat

This module adds support for products to be linked to contract templates.

A contract is created on sale.order confirmation for each different @@ -412,7 +412,7 @@

Bug Tracker

Bugs are tracked on GitHub 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.

+feedback.

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

@@ -449,7 +449,7 @@

Maintainers

promote its widespread use.

Current maintainer:

sbejaoui

-

This module is part of the OCA/contract project on GitHub.

+

This module is part of the OCA/contract project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/product_contract/views/sale_order.xml b/product_contract/views/sale_order.xml index 61fce5b15a..e21ee65a9d 100644 --- a/product_contract/views/sale_order.xml +++ b/product_contract/views/sale_order.xml @@ -95,7 +95,7 @@ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..7d41f1be0f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# generated from manifests external_dependencies +python-dateutil