From 119b5b670025c965e8a7435910aa643ec779fb9e 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/__manifest__.py | 10 +- contract/data/mail_template.xml | 150 +++++++++++------- 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/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 +- 19 files changed, 377 insertions(+), 232 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/__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.

- ]]>
+