From 87fb580a7d32a502549534ec3844455876bfc4d5 Mon Sep 17 00:00:00 2001
From: sbejaoui
Date: Mon, 4 Nov 2024 14:57:15 +0100
Subject: [PATCH] [18.0][MIG] contract
---
contract/README.rst | 16 +-
contract/__manifest__.py | 2 +-
contract/controllers/main.py | 4 +-
contract/data/contract_cron.xml | 2 -
contract/data/contract_renew_cron.xml | 2 -
contract/data/mail_template.xml | 33 +-
contract/models/contract.py | 4 +-
contract/report/contract_views.xml | 2 -
contract/report/report_contract.xml | 2 +-
contract/static/description/index.html | 12 +-
contract/tests/test_portal.py | 5 +-
contract/views/abstract_contract_line.xml | 8 +-
contract/views/contract.xml | 49 +--
contract/views/contract_line.xml | 16 +-
contract/views/contract_portal_templates.xml | 402 +++++++++---------
contract/views/contract_tag.xml | 6 +-
contract/views/contract_template.xml | 19 +-
contract/views/contract_terminate_reason.xml | 6 +-
.../contract_manually_create_invoice.py | 4 +-
19 files changed, 276 insertions(+), 318 deletions(-)
diff --git a/contract/README.rst b/contract/README.rst
index 0630d36c50..126e3b3fd5 100644
--- a/contract/README.rst
+++ b/contract/README.rst
@@ -17,13 +17,13 @@ Recurring - Contracts Management
: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/contract
+ :target: https://github.com/OCA/contract/tree/18.0/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-contract
+ :target: https://translation.odoo-community.org/projects/contract-18-0/contract-18-0-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|
@@ -93,9 +93,9 @@ Usage
|image2|
-.. |image| image:: https://raw.githubusercontent.com/OCA/contract/17.0/contract/static/src/screenshots/portal-my.png
-.. |image1| image:: https://raw.githubusercontent.com/OCA/contract/17.0/contract/static/src/screenshots/portal-list.png
-.. |image2| image:: https://raw.githubusercontent.com/OCA/contract/17.0/contract/static/src/screenshots/portal-detail.png
+.. |image| image:: https://raw.githubusercontent.com/OCA/contract/18.0/contract/static/src/screenshots/portal-my.png
+.. |image1| image:: https://raw.githubusercontent.com/OCA/contract/18.0/contract/static/src/screenshots/portal-list.png
+.. |image2| image:: https://raw.githubusercontent.com/OCA/contract/18.0/contract/static/src/screenshots/portal-detail.png
Known issues / Roadmap
======================
@@ -109,7 +109,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.
@@ -166,6 +166,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-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/contract/__manifest__.py b/contract/__manifest__.py
index 28b4634a38..82ac23f6bd 100644
--- a/contract/__manifest__.py
+++ b/contract/__manifest__.py
@@ -11,7 +11,7 @@
{
"name": "Recurring - Contracts Management",
- "version": "17.0.1.1.1",
+ "version": "18.0.1.0.0",
"category": "Contract Management",
"license": "AGPL-3",
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",
diff --git a/contract/controllers/main.py b/contract/controllers/main.py
index e588bd02fe..ee61d576bf 100644
--- a/contract/controllers/main.py
+++ b/contract/controllers/main.py
@@ -16,7 +16,7 @@ def _prepare_home_portal_values(self, counters):
contract_model = request.env["contract.contract"]
contract_count = (
contract_model.search_count([])
- if contract_model.check_access_rights("read", raise_exception=False)
+ if contract_model.check_access("read")
else 0
)
values["contract_count"] = contract_count
@@ -46,7 +46,7 @@ def portal_my_contracts(
values = self._prepare_portal_layout_values()
contract_obj = request.env["contract.contract"]
# Avoid error if the user does not have access.
- if not contract_obj.check_access_rights("read", raise_exception=False):
+ if not contract_obj.check_access("read"):
return request.redirect("/my")
domain = self._get_filter_domain(kw)
searchbar_sortings = {
diff --git a/contract/data/contract_cron.xml b/contract/data/contract_cron.xml
index 379e7a0a26..524e1e5c33 100644
--- a/contract/data/contract_cron.xml
+++ b/contract/data/contract_cron.xml
@@ -8,7 +8,5 @@
1
days
- -1
-
diff --git a/contract/data/contract_renew_cron.xml b/contract/data/contract_renew_cron.xml
index 1a5b570250..aea0e67fb7 100644
--- a/contract/data/contract_renew_cron.xml
+++ b/contract/data/contract_renew_cron.xml
@@ -8,7 +8,5 @@
1
days
- -1
-
diff --git a/contract/data/mail_template.xml b/contract/data/mail_template.xml
index b5ac2103ab..9e51d18fb4 100644
--- a/contract/data/mail_template.xml
+++ b/contract/data/mail_template.xml
@@ -28,30 +28,30 @@
Contract:
Contract Date Start:
+ t-out="object.date_start or ''"
+ />
-
+
Your Contact:
+ t-att-href="'mailto:%s?subject=Contract %s' % (object.user_id.email, object.name)"
+ t-out="object.user_id.name"
+ />
-
+
Your Contact:
+ t-out="object.user_id.name"
+ />
-
+
If you have any questions, do not hesitate to contact us.
Thank you for choosing !
+ t-out="object.company_id.name or 'us'"
+ />!
+ />
+
Web:
+ t-att-href="object.company_id.website"
+ t-out="object.company_id.website"
+ />
diff --git a/contract/models/contract.py b/contract/models/contract.py
index 7208e276b4..7a61159ed0 100644
--- a/contract/models/contract.py
+++ b/contract/models/contract.py
@@ -298,12 +298,12 @@ def action_show_invoices(self):
"type": "ir.actions.act_window",
"name": "Invoices",
"res_model": "account.move",
- "view_mode": "tree,kanban,form,calendar,pivot,graph,activity",
+ "view_mode": "list,kanban,form,calendar,pivot,graph,activity",
"domain": [("id", "in", self._get_related_invoices().ids)],
"context": ctx,
}
if tree_view and form_view:
- action["views"] = [(tree_view.id, "tree"), (form_view.id, "form")]
+ action["views"] = [(tree_view.id, "list"), (form_view.id, "form")]
return action
@api.depends("contract_line_ids.date_end")
diff --git a/contract/report/contract_views.xml b/contract/report/contract_views.xml
index fa4e07ec16..167a616b30 100644
--- a/contract/report/contract_views.xml
+++ b/contract/report/contract_views.xml
@@ -1,6 +1,5 @@
-
Contract
contract.contract
@@ -10,5 +9,4 @@
report
-
diff --git a/contract/report/report_contract.xml b/contract/report/report_contract.xml
index 4eed574b86..8860ff3260 100644
--- a/contract/report/report_contract.xml
+++ b/contract/report/report_contract.xml
@@ -14,7 +14,7 @@
VAT:
-
+
diff --git a/contract/tests/test_portal.py b/contract/tests/test_portal.py
index 50aca2abf6..d34b26ba8c 100644
--- a/contract/tests/test_portal.py
+++ b/contract/tests/test_portal.py
@@ -18,9 +18,8 @@ def test_tour(self):
# Contract access
self.authenticate("portal", "portal")
http.root.session_store.save(self.session)
- url_contract = "/my/contracts/{}?access_token={}".format(
- contract.id,
- contract.access_token,
+ url_contract = (
+ f"/my/contracts/{contract.id}?access_token={contract.access_token}"
)
self.assertEqual(self.url_open(url=url_contract).status_code, 200)
contract.message_unsubscribe(partner_ids=user_portal.partner_id.ids)
diff --git a/contract/views/abstract_contract_line.xml b/contract/views/abstract_contract_line.xml
index abd0a857fc..d755fe1264 100644
--- a/contract/views/abstract_contract_line.xml
+++ b/contract/views/abstract_contract_line.xml
@@ -25,7 +25,6 @@
-
@@ -35,10 +34,7 @@
groups="uom.group_uom"
required="not display_type"
/>
-
+
@@ -106,6 +102,8 @@
+
+
diff --git a/contract/views/contract.xml b/contract/views/contract.xml
index eae34394ee..50c5421594 100644
--- a/contract/views/contract.xml
+++ b/contract/views/contract.xml
@@ -17,11 +17,8 @@
This contract was terminated for the reason
-
-
+
+
on
.
@@ -183,7 +180,7 @@
widget="section_and_note_one2many"
context="{'default_contract_type': contract_type, 'default_recurring_rule_type': recurring_rule_type, 'default_recurring_invoicing_type': recurring_invoicing_type, 'default_recurring_interval': recurring_interval, 'default_date_start': date_start, 'default_recurring_next_date': recurring_next_date}"
>
-
-
+
-
+
-
@@ -329,10 +323,7 @@
name="specific_price"
column_invisible="True"
/>
-
+
-
+
-
+
-
+
@@ -482,11 +473,7 @@
-
-
-
-
-
+
@@ -530,10 +517,10 @@
- contract.contract tree view (in contract)
+ contract.contract list view (in contract)
contract.contract
-
+
@@ -545,7 +532,7 @@
/>
-
+
@@ -611,7 +598,7 @@
Customer Contracts
contract.contract
- tree,form
+ list,form
[('contract_type', '=', 'sale')]
{'is_contract':1,
@@ -627,7 +614,7 @@
- tree
+ list
@@ -647,7 +634,7 @@
Supplier Contracts
contract.contract
- tree,form
+ list,form
[('contract_type', '=', 'purchase')]
{'is_contract':1,
@@ -663,7 +650,7 @@
- tree
+ list
diff --git a/contract/views/contract_line.xml b/contract/views/contract_line.xml
index 51deb9f675..3e9eae9b2f 100644
--- a/contract/views/contract_line.xml
+++ b/contract/views/contract_line.xml
@@ -17,11 +17,15 @@
+
+
+
+
+
-
@@ -85,10 +89,10 @@
- contract.line tree view (in contract)
+ contract.line list view (in contract)
contract.line
-
@@ -105,7 +109,7 @@
-
+
@@ -166,12 +170,12 @@
groups="base.group_no_one"
invisible="not is_auto_renew"
/>
-
+
- contract.line supplier tree view (in contract)
+ contract.line supplier list view (in contract)
contract.line
primary
diff --git a/contract/views/contract_portal_templates.xml b/contract/views/contract_portal_templates.xml
index 01c2f19169..9d5f86fdd4 100644
--- a/contract/views/contract_portal_templates.xml
+++ b/contract/views/contract_portal_templates.xml
@@ -91,235 +91,213 @@
/>
-
-
-
-
+
+
+
Contract -
-
-
-
-