From da393c937d736d9cee3ff848a10216c6dfac9b0a Mon Sep 17 00:00:00 2001 From: Jean-Charles Drubay Date: Thu, 28 Oct 2021 18:24:51 +0700 Subject: [PATCH] [MIG] contract: Migration to 15.0 Most changes are related to the switch from jinja to qweb in mail templates. Also included: - convert deprecated onchange that returns a domain and other deprecation warnings (see below) - Add migration scripts from version 14.0 (force the update of the mail templates) - Fix warnings from pre-commit checks Fixes depreciation warnings: - onchange method ContractAbstractContractLine._onchange_product_id returned a domain, this is deprecated - SavepointCase is deprecated: https://github.com/odoo/odoo/blob/15.0/odoo/tests/common.py#L742 - assertDictContainsSubset: According to: https://stackoverflow.com/questions/20050913/python-unittests-assertdictcontainssubset-recommended-alternative --- contract/README.rst | 16 +- contract/__manifest__.py | 10 +- contract/data/mail_template.xml | 150 ++++++----- contract/i18n/contract.pot | 236 +++++++++--------- contract/i18n/hr_HR.po | 2 +- contract/i18n/it.po | 2 +- contract/i18n/tr_TR.po | 2 +- .../15.0.1.0.0/noupdate_changes.xml | 141 +++++++++++ .../migrations/15.0.1.0.0/post-migration.py | 17 ++ contract/models/abstract_contract_line.py | 23 +- contract/models/contract.py | 32 +-- contract/models/contract_line.py | 102 ++++---- contract/models/contract_modification.py | 9 +- contract/models/contract_recurrency_mixin.py | 8 +- contract/models/res_company.py | 1 - contract/static/description/index.html | 12 +- contract/tests/test_contract.py | 55 ++-- contract/views/abstract_contract_line.xml | 2 + contract/views/assets.xml | 40 --- contract/views/contract.xml | 4 + contract/wizards/contract_line_wizard.py | 7 +- .../contract_manually_create_invoice.py | 2 +- 22 files changed, 510 insertions(+), 363 deletions(-) create mode 100644 contract/migrations/15.0.1.0.0/noupdate_changes.xml create mode 100644 contract/migrations/15.0.1.0.0/post-migration.py delete mode 100644 contract/views/assets.xml diff --git a/contract/README.rst b/contract/README.rst index 1c38ac2dc..9d47cd057 100644 --- a/contract/README.rst +++ b/contract/README.rst @@ -14,13 +14,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/14.0/contract + :target: https://github.com/OCA/contract/tree/15.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-14-0/contract-14-0-contract + :target: https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/110/14.0 + :target: https://runbot.odoo-community.org/runbot/110/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -76,9 +76,9 @@ Usage * Contracts appear in portal to following users in every contract: -.. image:: https://raw.githubusercontent.com/OCA/contract/14.0/contract/static/src/screenshots/portal-my.png -.. image:: https://raw.githubusercontent.com/OCA/contract/14.0/contract/static/src/screenshots/portal-list.png -.. image:: https://raw.githubusercontent.com/OCA/contract/14.0/contract/static/src/screenshots/portal-detail.png +.. image:: https://raw.githubusercontent.com/OCA/contract/15.0/contract/static/src/screenshots/portal-my.png +.. image:: https://raw.githubusercontent.com/OCA/contract/15.0/contract/static/src/screenshots/portal-list.png +.. image:: https://raw.githubusercontent.com/OCA/contract/15.0/contract/static/src/screenshots/portal-detail.png Known issues / Roadmap ====================== @@ -92,7 +92,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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -138,6 +138,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 4a3fb3af2..5e4245684 100644 --- a/contract/__manifest__.py +++ b/contract/__manifest__.py @@ -11,7 +11,7 @@ { "name": "Recurring - Contracts Management", - "version": "14.0.1.2.3", + "version": "15.0.1.0.0", "category": "Contract Management", "license": "AGPL-3", "author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)", @@ -35,7 +35,6 @@ "wizards/contract_manually_create_invoice.xml", "wizards/contract_contract_terminate.xml", "views/contract_tag.xml", - "views/assets.xml", "views/abstract_contract_line.xml", "views/contract.xml", "views/contract_line.xml", @@ -46,5 +45,12 @@ "views/contract_terminate_reason.xml", "views/contract_portal_templates.xml", ], + "assets": { + "web.assets_backend": [ + "contract/static/src/js/section_and_note_fields_backend.js", + ], + "web.assets_frontend": ["contract/static/src/scss/frontend.scss"], + "web.assets_tests": ["contract/static/src/js/contract_portal_tour.js"], + }, "installable": True, } diff --git a/contract/data/mail_template.xml b/contract/data/mail_template.xml index 209de8480..1a6f06666 100644 --- a/contract/data/mail_template.xml +++ b/contract/data/mail_template.xml @@ -4,93 +4,121 @@ Email Contract Template ${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe} + >{{ (object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '') }} ${object.company_id.name} Contract (Ref ${object.name or 'n/a'}) - ${object.partner_id.id} + >{{ object.company_id.name }} Contract (Ref {{ object.name or 'n/a' }}) + {{ object.partner_id.id }} Contract - ${object.partner_id.lang} - -

Hello ${object.partner_id.name or ''},

-

A new contract has been created:

+ {{ object.partner_id.lang }} + +
+

Hello ,

+

A new contract has been created:

-

-   REFERENCES
-   Contract: ${object.name}
- % if object.date_start: -   Contract Date Start: ${object.date_start or ''}
- % endif +

+ &nbsp;&nbsp;REFERENCES
+ &nbsp;&nbsp;Contract:
+ + &nbsp;&nbsp;Contract Date Start:
+
- % if object.user_id: - % if object.user_id.email: -   Your Contact: ${object.user_id.name} - % else: -   Your Contact: ${object.user_id.name} - % endif - % endif -

+ + + &nbsp;&nbsp;Your Contact: + + + &nbsp;&nbsp;Your Contact: + + +

-
-

If you have any questions, do not hesitate to contact us.

-

Thank you for choosing ${object.company_id.name or 'us'}!

-
-
-
-

- ${object.company_id.name}

-
-
-

- View contract -
- ]]>
+
Contract Modification Template ${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe} + >{{ (object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '') }}
${object.company_id.name} Contract (Ref ${object.name or 'n/a'}) - Modifications + >{{ object.company_id.name }} Contract (Ref {{ object.name or 'n/a' }}) - Modifications
- ${object.partner_id.lang} - {{ object.partner_id.lang }} +

Hello

We have modifications on the contract that we want to notify you.

- ]]>
+