From 5736d92acecff2485e79caef6ff3d9f7a7073e55 Mon Sep 17 00:00:00 2001 From: Patrick Wilson <36892066+patrickrwilson@users.noreply.github.com> Date: Tue, 4 May 2021 11:38:03 -0600 Subject: [PATCH] [14.0][MIG] agreement_legal (Version 12.0 to 14.0) [MIG] Black & Cleanup [IMP] Reviewer Requested Changes [IMP] Black [IMP] Reviewer Suggestion [FIX] Tests [FIX] Multiple Issues - Added 'is_old_version' field to better display old versions. Before these were marked as inactive therefore not showing in the agreement. - 'is_template' field now copies when making a template revision or copying a template. - New Versions now retain original create date. - Moved version/revision and created on/by fields out of footer to top in order to have the save buttons when creating children. - Moved demo data out of data folder into the demo.xml [FIX] demo data [FIX] Revert back to only migration [FIX] Report dynamic field rendering [FIX] Test --- agreement_legal/__init__.py | 8 - agreement_legal/__manifest__.py | 12 +- agreement_legal/data/agreement_stage.xml | 1 - agreement_legal/data/agreement_type.xml | 1 - agreement_legal/data/demo.xml | 77 +-- agreement_legal/data/ir_sequence.xml | 3 +- agreement_legal/data/module_category.xml | 1 - agreement_legal/demo/demo.xml | 18 +- agreement_legal/i18n/fr.po | 25 +- agreement_legal/i18n/pt.po | 2 + agreement_legal/i18n/pt_BR.po | 18 +- agreement_legal/i18n/pt_PT.po | 3 + agreement_legal/i18n/zh_CN.po | 3 + .../migrations/12.0.2.0.0/post-migration.py | 10 - agreement_legal/models/agreement.py | 285 +++++----- agreement_legal/models/agreement_appendix.py | 37 +- agreement_legal/models/agreement_clause.py | 65 +-- .../models/agreement_increasetype.py | 7 +- agreement_legal/models/agreement_line.py | 18 +- agreement_legal/models/agreement_recital.py | 11 +- .../models/agreement_renewaltype.py | 4 +- agreement_legal/models/agreement_section.py | 43 +- agreement_legal/models/agreement_stage.py | 17 +- agreement_legal/models/agreement_subtype.py | 4 +- agreement_legal/models/agreement_type.py | 4 +- agreement_legal/models/product_template.py | 4 +- agreement_legal/models/res_config_settings.py | 3 +- agreement_legal/models/res_partner.py | 5 +- agreement_legal/report/agreement.xml | 114 ++-- agreement_legal/security/res_groups.xml | 26 +- .../static/src/js/domain_widget_ext.js | 85 +++ .../static/src/xml/domain_widget_view.xml | 298 +++++++++++ agreement_legal/tests/__init__.py | 8 + agreement_legal/tests/test_agreement.py | 131 +++++ .../tests/test_agreement_appendix.py | 81 +++ .../tests/test_agreement_clause.py | 81 +++ agreement_legal/tests/test_agreement_line.py | 45 ++ .../tests/test_agreement_recital.py | 81 +++ .../tests/test_agreement_section.py | 81 +++ agreement_legal/views/agreement.xml | 493 ++++++++++++------ agreement_legal/views/agreement_appendix.xml | 75 +-- agreement_legal/views/agreement_clause.xml | 87 ++-- .../views/agreement_increasetype.xml | 13 +- agreement_legal/views/agreement_recital.xml | 74 +-- .../views/agreement_renewaltype.xml | 9 +- agreement_legal/views/agreement_section.xml | 92 ++-- agreement_legal/views/agreement_stages.xml | 17 +- agreement_legal/views/agreement_subtype.xml | 13 +- agreement_legal/views/agreement_type.xml | 12 +- agreement_legal/views/menu.xml | 238 +++++---- agreement_legal/views/res_config_settings.xml | 114 ++-- agreement_legal/views/res_partner.xml | 6 +- 52 files changed, 2065 insertions(+), 898 deletions(-) delete mode 100644 agreement_legal/migrations/12.0.2.0.0/post-migration.py create mode 100644 agreement_legal/static/src/js/domain_widget_ext.js create mode 100644 agreement_legal/static/src/xml/domain_widget_view.xml create mode 100644 agreement_legal/tests/__init__.py create mode 100644 agreement_legal/tests/test_agreement.py create mode 100644 agreement_legal/tests/test_agreement_appendix.py create mode 100644 agreement_legal/tests/test_agreement_clause.py create mode 100644 agreement_legal/tests/test_agreement_line.py create mode 100644 agreement_legal/tests/test_agreement_recital.py create mode 100644 agreement_legal/tests/test_agreement_section.py diff --git a/agreement_legal/__init__.py b/agreement_legal/__init__.py index c8c5c214f..073035d16 100644 --- a/agreement_legal/__init__.py +++ b/agreement_legal/__init__.py @@ -1,12 +1,4 @@ # Copyright (C) 2018 - TODAY, Pavlov Media # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, SUPERUSER_ID from . import models - - -def post_init_agreement_legal(cr, registry): - env = api.Environment(cr, SUPERUSER_ID, dict()) - cr.execute('UPDATE agreement SET stage_id = %s WHERE stage_id IS NULL;', - (env.ref('agreement_legal.agreement_stage_new').id,)) - return True diff --git a/agreement_legal/__manifest__.py b/agreement_legal/__manifest__.py index 8b180d20e..00062b154 100644 --- a/agreement_legal/__manifest__.py +++ b/agreement_legal/__manifest__.py @@ -11,7 +11,7 @@ "website": "https://github.com/OCA/contract", "category": "Partner", "license": "AGPL-3", - "version": "12.0.2.0.1", + "version": "14.0.1.0.0", "depends": ["contacts", "agreement", "product"], "data": [ "data/ir_sequence.xml", @@ -36,14 +36,8 @@ "views/agreement.xml", "views/menu.xml", ], - "demo": [ - "demo/demo.xml" - ], - "post_init_hook": "post_init_agreement_legal", + "demo": ["demo/demo.xml"], "application": True, "development_status": "Beta", - "maintainers": [ - "max3903", - "ygol" - ], + "maintainers": ["max3903", "ygol"], } diff --git a/agreement_legal/data/agreement_stage.xml b/agreement_legal/data/agreement_stage.xml index 66e399efb..0f930eab7 100644 --- a/agreement_legal/data/agreement_stage.xml +++ b/agreement_legal/data/agreement_stage.xml @@ -1,4 +1,3 @@ - diff --git a/agreement_legal/data/agreement_type.xml b/agreement_legal/data/agreement_type.xml index 4cdf67618..8335f8e5d 100644 --- a/agreement_legal/data/agreement_type.xml +++ b/agreement_legal/data/agreement_type.xml @@ -1,4 +1,3 @@ - diff --git a/agreement_legal/data/demo.xml b/agreement_legal/data/demo.xml index eb1b85603..bc4a10552 100644 --- a/agreement_legal/data/demo.xml +++ b/agreement_legal/data/demo.xml @@ -1,146 +1,121 @@ - - - + - Hardware IT (C2C-IT0042) - 1 + - + + - + - Fiber access office Lausanne (C2C-IT0043) - 2 + - + + - + - Vétérinaire (AGR-VETO001) - 3 + - + + - + - - Wazo IPBX deployment and maintenance (AGR-TEL001) - 3 + Wazo IPBX deployment and maintenance (AGR-TEL001) + - + + - + - SIP Phones supply (BUY-VOIP012) - 1 + - + + - + - SIP-ISDN gateways (BUY-VOIP013) - 2 + - + diff --git a/agreement_legal/data/ir_sequence.xml b/agreement_legal/data/ir_sequence.xml index d2104c559..df477fb4a 100644 --- a/agreement_legal/data/ir_sequence.xml +++ b/agreement_legal/data/ir_sequence.xml @@ -1,4 +1,3 @@ - @@ -7,7 +6,7 @@ agreement AG 3 - + diff --git a/agreement_legal/data/module_category.xml b/agreement_legal/data/module_category.xml index d3c2ee7a7..da4af85af 100644 --- a/agreement_legal/data/module_category.xml +++ b/agreement_legal/data/module_category.xml @@ -1,4 +1,3 @@ - diff --git a/agreement_legal/demo/demo.xml b/agreement_legal/demo/demo.xml index 9edf7dd3b..7e178adc9 100644 --- a/agreement_legal/demo/demo.xml +++ b/agreement_legal/demo/demo.xml @@ -1,40 +1,40 @@ - - Hardware IT (C2C-IT0042) - + Fiber access office Lausanne (C2C-IT0043) - + Vétérinaire (AGR-VETO001) - + - Wazo IPBX deployment and maintenance (AGR-TEL001) - + Wazo IPBX deployment and maintenance (AGR-TEL001) + SIP Phones supply (BUY-VOIP012) - + True SIP-ISDN gateways (BUY-VOIP013) - + diff --git a/agreement_legal/i18n/fr.po b/agreement_legal/i18n/fr.po index cac43fae2..e6c28d3bf 100644 --- a/agreement_legal/i18n/fr.po +++ b/agreement_legal/i18n/fr.po @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-03-24 16:40+0000\n" -"PO-Revision-Date: 2021-01-04 11:44+0000\n" -"Last-Translator: Rémi \n" +"PO-Revision-Date: 2019-09-12 11:23+0000\n" +"Last-Translator: Yves Goldberg \n" "Language-Team: \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 3.8\n" #. module: agreement_legal #. openerp-web @@ -338,6 +338,8 @@ msgstr "Informations sur la société" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__company_partner_id +#, fuzzy +#| msgid "Company Contact" msgid "Company's Partner" msgstr "Contact de la société" @@ -553,9 +555,10 @@ msgstr "Domaine" #. openerp-web #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:79 #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:83 -#, python-format +#, fuzzy, python-format +#| msgid "Domain" msgid "Domain node" -msgstr "Nœud de domaine" +msgstr "Domaine" #. module: agreement_legal #: selection:agreement,state:0 @@ -892,8 +895,10 @@ msgstr "Entretien" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_res_config_settings__module_fieldservice_agreement +#, fuzzy +#| msgid "Agreements" msgid "Manage Agreements" -msgstr "Gérer les Accords" +msgstr "Accords" #. module: agreement_legal #: model_terms:ir.ui.view,arch_db:agreement_legal.res_config_settings_view_form @@ -986,12 +991,12 @@ msgstr "Adresse de notification" #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__expiration_notice msgid "Number of Days before expiration to be notified." -msgstr "Nombre de jours avant l'expiration pour être notifié." +msgstr "Nombre de jours avant expiration à notifier." #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__change_notice msgid "Number of Days to be notified before changes." -msgstr "Nombre de jours pour être notifié avant les modifications." +msgstr "Nombre de jours à notifier avant les modifications." #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__term @@ -1350,8 +1355,10 @@ msgstr "" #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__agreement_type_id +#, fuzzy +#| msgid "Select the type of agreement." msgid "Select the type of agreement" -msgstr "Sélectionner le type d'accord" +msgstr "Sélectionnez le type d'accord." #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__assigned_user_id diff --git a/agreement_legal/i18n/pt.po b/agreement_legal/i18n/pt.po index 79b7259e0..b458b8de7 100644 --- a/agreement_legal/i18n/pt.po +++ b/agreement_legal/i18n/pt.po @@ -553,6 +553,7 @@ msgstr "Domínio" #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:79 #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:83 #, fuzzy, python-format +#| msgid "Domain" msgid "Domain node" msgstr "Domínio" @@ -885,6 +886,7 @@ msgstr "Manutenção" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_res_config_settings__module_fieldservice_agreement #, fuzzy +#| msgid "Agreements" msgid "Manage Agreements" msgstr "Acordos" diff --git a/agreement_legal/i18n/pt_BR.po b/agreement_legal/i18n/pt_BR.po index 10ef1ad53..c008b5a51 100644 --- a/agreement_legal/i18n/pt_BR.po +++ b/agreement_legal/i18n/pt_BR.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2020-11-06 08:08+0000\n" -"Last-Translator: Eder Brito \n" +"PO-Revision-Date: 2020-08-10 16:59+0000\n" +"Last-Translator: Fernando Colus \n" "Language-Team: none\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" @@ -97,17 +97,17 @@ msgstr "Acordo" #. module: agreement_legal #: model:ir.model,name:agreement_legal.model_agreement_appendix msgid "Agreement Appendices" -msgstr "Apêndices do acordo" +msgstr "Adendos do acordo" #. module: agreement_legal #: model_terms:ir.ui.view,arch_db:agreement_legal.agreement_clause_search_view msgid "Agreement Clause Search" -msgstr "Pesquisa de Cláusulas do Acordo" +msgstr "Busca de cláusulas" #. module: agreement_legal #: model:ir.model,name:agreement_legal.model_agreement_clause msgid "Agreement Clauses" -msgstr "Cláusulas do Acordo" +msgstr "Cláusulas do acordo" #. module: agreement_legal #: model:ir.actions.act_window,name:agreement_legal.partner_agreement_action_increasetype @@ -421,7 +421,7 @@ msgstr "Criar um acordo quando a venda é confirmada." #. module: agreement_legal #: model_terms:ir.ui.view,arch_db:agreement_legal.res_config_settings_view_form msgid "Create an agreement when the sales order is confirmed" -msgstr "Crie um acordo quando a venda é confirmada" +msgstr "Crie o acordo quando a venda é confirmada" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement_appendix__create_uid @@ -457,7 +457,7 @@ msgstr "Moeda" #. module: agreement_legal #: model:ir.ui.menu,name:agreement_legal.agreement_dashboard msgid "Dashboard" -msgstr "Dashboard" +msgstr "Painel" #. module: agreement_legal #: model:ir.model.fields,help:agreement_legal.field_agreement__termination_requested @@ -599,7 +599,7 @@ msgstr "Editar Domínio" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__company_contact_email msgid "Email" -msgstr "E-mail" +msgstr "Email" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__end_date @@ -632,7 +632,7 @@ msgstr "Expressão do Campo" #. module: agreement_legal #: model_terms:ir.ui.view,arch_db:agreement_legal.res_config_settings_view_form msgid "Field Service" -msgstr "Serviço de Campo" +msgstr "Serviço em Campo" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__signed_contract_filename diff --git a/agreement_legal/i18n/pt_PT.po b/agreement_legal/i18n/pt_PT.po index 207ba9815..0e3f2edd1 100644 --- a/agreement_legal/i18n/pt_PT.po +++ b/agreement_legal/i18n/pt_PT.po @@ -336,6 +336,7 @@ msgstr "Empresa - Informações" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__company_partner_id #, fuzzy +#| msgid "Company Contact" msgid "Company's Partner" msgstr "Empresa - Contacto" @@ -553,6 +554,7 @@ msgstr "Domínio" #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:79 #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:83 #, fuzzy, python-format +#| msgid "Domain" msgid "Domain node" msgstr "Domínio" @@ -886,6 +888,7 @@ msgstr "Manutenção" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_res_config_settings__module_fieldservice_agreement #, fuzzy +#| msgid "Agreements" msgid "Manage Agreements" msgstr "Contratos" diff --git a/agreement_legal/i18n/zh_CN.po b/agreement_legal/i18n/zh_CN.po index 60eba9e82..cf0feb4e4 100644 --- a/agreement_legal/i18n/zh_CN.po +++ b/agreement_legal/i18n/zh_CN.po @@ -336,6 +336,7 @@ msgstr "公司信息" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_agreement__company_partner_id #, fuzzy +#| msgid "Company Contact" msgid "Company's Partner" msgstr "公司联系人" @@ -551,6 +552,7 @@ msgstr "域" #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:79 #: code:addons/agreement_legal/static/src/xml/domain_widget_view.xml:83 #, fuzzy, python-format +#| msgid "Domain" msgid "Domain node" msgstr "域" @@ -880,6 +882,7 @@ msgstr "维护" #. module: agreement_legal #: model:ir.model.fields,field_description:agreement_legal.field_res_config_settings__module_fieldservice_agreement #, fuzzy +#| msgid "Agreements" msgid "Manage Agreements" msgstr "协议" diff --git a/agreement_legal/migrations/12.0.2.0.0/post-migration.py b/agreement_legal/migrations/12.0.2.0.0/post-migration.py deleted file mode 100644 index 57c5df8c6..000000000 --- a/agreement_legal/migrations/12.0.2.0.0/post-migration.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (C) 2020 Serpent Consulting Services -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - - -def migrate(env, version): - if not version: - return - - env.execute("UPDATE agreement_stage SET stage_type = 'agreement' " - "WHERE stage_type IS NULL;") diff --git a/agreement_legal/models/agreement.py b/agreement_legal/models/agreement.py index c88ac6495..d0450bcd9 100644 --- a/agreement_legal/models/agreement.py +++ b/agreement_legal/models/agreement.py @@ -7,129 +7,144 @@ from odoo import _, api, fields, models class Agreement(models.Model): _inherit = "agreement" - # General name = fields.Char(string="Title", required=True) version = fields.Integer( string="Version", default=1, copy=False, help="The versions are used to keep track of document history and " - "previous versions can be referenced.") + "previous versions can be referenced.", + ) revision = fields.Integer( string="Revision", default=0, copy=False, - help="The revision will increase with every save event.") + help="The revision will increase with every save event.", + ) description = fields.Text( - string="Description", - track_visibility="onchange", - help="Description of the agreement") + string="Description", tracking=True, help="Description of the agreement" + ) dynamic_description = fields.Text( compute="_compute_dynamic_description", string="Dynamic Description", - help="Compute dynamic description") + help="Compute dynamic description", + ) start_date = fields.Date( - string="Start Date", - track_visibility="onchange", - help="When the agreement starts.") + string="Start Date", tracking=True, help="When the agreement starts." + ) end_date = fields.Date( - string="End Date", - track_visibility="onchange", - help="When the agreement ends.") + string="End Date", tracking=True, help="When the agreement ends." + ) color = fields.Integer(string="Color") active = fields.Boolean( string="Active", default=True, help="If unchecked, it will allow you to hide the agreement without " - "removing it.") + "removing it.", + ) company_signed_date = fields.Date( string="Signed on", - track_visibility="onchange", - help="Date the contract was signed by Company.") + tracking=True, + help="Date the contract was signed by Company.", + ) partner_signed_date = fields.Date( string="Signed on (Partner)", - track_visibility="onchange", - help="Date the contract was signed by the Partner.") + tracking=True, + help="Date the contract was signed by the Partner.", + ) term = fields.Integer( string="Term (Months)", - track_visibility="onchange", + tracking=True, help="Number of months this agreement/contract is in effect with the " - "partner.") + "partner.", + ) expiration_notice = fields.Integer( string="Exp. Notice (Days)", - track_visibility="onchange", - help="Number of Days before expiration to be notified.") + tracking=True, + help="Number of Days before expiration to be notified.", + ) change_notice = fields.Integer( string="Change Notice (Days)", - track_visibility="onchange", - help="Number of Days to be notified before changes.") + tracking=True, + help="Number of Days to be notified before changes.", + ) special_terms = fields.Text( string="Special Terms", - track_visibility="onchange", + tracking=True, help="Any terms that you have agreed to and want to track on the " - "agreement/contract.") + "agreement/contract.", + ) dynamic_special_terms = fields.Text( compute="_compute_dynamic_special_terms", string="Dynamic Special Terms", - help="Compute dynamic special terms") + help="Compute dynamic special terms", + ) code = fields.Char( string="Reference", required=True, default=lambda self: _("New"), - track_visibility="onchange", + tracking=True, copy=False, - help="ID used for internal contract tracking.") + help="ID used for internal contract tracking.", + ) increase_type_id = fields.Many2one( "agreement.increasetype", string="Increase Type", - track_visibility="onchange", - help="The amount that certain rates may increase.") + tracking=True, + help="The amount that certain rates may increase.", + ) termination_requested = fields.Date( string="Termination Requested Date", - track_visibility="onchange", - help="Date that a request for termination was received.") + tracking=True, + help="Date that a request for termination was received.", + ) termination_date = fields.Date( string="Termination Date", - track_visibility="onchange", - help="Date that the contract was terminated.") - reviewed_date = fields.Date( - string="Reviewed Date", track_visibility="onchange") - reviewed_user_id = fields.Many2one( - "res.users", string="Reviewed By", track_visibility="onchange") - approved_date = fields.Date( - string="Approved Date", track_visibility="onchange") - approved_user_id = fields.Many2one( - "res.users", string="Approved By", track_visibility="onchange") + tracking=True, + help="Date that the contract was terminated.", + ) + reviewed_date = fields.Date(string="Reviewed Date", tracking=True) + reviewed_user_id = fields.Many2one("res.users", string="Reviewed By", tracking=True) + approved_date = fields.Date(string="Approved Date", tracking=True) + approved_user_id = fields.Many2one("res.users", string="Approved By", tracking=True) currency_id = fields.Many2one("res.currency", string="Currency") partner_id = fields.Many2one( "res.partner", string="Partner", required=False, copy=True, - help="The customer or vendor this agreement is related to.") + help="The customer or vendor this agreement is related to.", + ) partner_contact_id = fields.Many2one( "res.partner", string="Partner Contact", copy=True, - help="The primary partner contact (If Applicable).") + help="The primary partner contact (If Applicable).", + ) partner_contact_phone = fields.Char( - related="partner_contact_id.phone", string="Partner Phone") + related="partner_contact_id.phone", string="Partner Phone" + ) partner_contact_email = fields.Char( - related="partner_contact_id.email", string="Partner Email") + related="partner_contact_id.email", string="Partner Email" + ) company_contact_id = fields.Many2one( "res.partner", string="Company Contact", copy=True, - help="The primary contact in the company.") + help="The primary contact in the company.", + ) company_contact_phone = fields.Char( - related="company_contact_id.phone", string="Phone") + related="company_contact_id.phone", string="Phone" + ) company_contact_email = fields.Char( - related="company_contact_id.email", string="Email") + related="company_contact_id.email", string="Email" + ) use_parties_content = fields.Boolean( - string="Use parties content", - help="Use custom content for parties") + string="Use parties content", help="Use custom content for parties" + ) company_partner_id = fields.Many2one( - related="company_id.partner_id", string="Company's Partner") + related="company_id.partner_id", string="Company's Partner" + ) def _get_default_parties(self): deftext = """ @@ -158,147 +173,156 @@ class Agreement(models.Model): parties = fields.Html( string="Parties", - track_visibility="onchange", + tracking=True, default=_get_default_parties, - help="Parties of the agreement") + help="Parties of the agreement", + ) dynamic_parties = fields.Html( compute="_compute_dynamic_parties", string="Dynamic Parties", - help="Compute dynamic parties") + help="Compute dynamic parties", + ) agreement_type_id = fields.Many2one( - track_visibility="onchange", + tracking=True, ) agreement_subtype_id = fields.Many2one( "agreement.subtype", string="Agreement Sub-type", - track_visibility="onchange", + tracking=True, help="Select the sub-type of this agreement. Sub-Types are related to " - "agreement types.") - product_ids = fields.Many2many( - "product.template", string="Products & Services") + "agreement types.", + ) + product_ids = fields.Many2many("product.template", string="Products & Services") assigned_user_id = fields.Many2one( "res.users", string="Assigned To", - track_visibility="onchange", - help="Select the user who manages this agreement.") + tracking=True, + help="Select the user who manages this agreement.", + ) company_signed_user_id = fields.Many2one( "res.users", string="Signed By", - track_visibility="onchange", + tracking=True, help="The user at our company who authorized/signed the agreement or " - "contract.") + "contract.", + ) partner_signed_user_id = fields.Many2one( "res.partner", string="Signed By (Partner)", - track_visibility="onchange", - help="Contact on the account that signed the agreement/contract.") + tracking=True, + help="Contact on the account that signed the agreement/contract.", + ) parent_agreement_id = fields.Many2one( "agreement", string="Parent Agreement", help="Link this agreement to a parent agreement. For example if this " "agreement is an amendment to another agreement. This list will " - "only show other agreements related to the same account.") + "only show other agreements related to the same account.", + ) renewal_type_id = fields.Many2one( "agreement.renewaltype", string="Renewal Type", - track_visibility="onchange", - help="Describes what happens after the contract expires.") + tracking=True, + help="Describes what happens after the contract expires.", + ) recital_ids = fields.One2many( - "agreement.recital", "agreement_id", string="Recitals", copy=True) + "agreement.recital", "agreement_id", string="Recitals", copy=True + ) sections_ids = fields.One2many( - "agreement.section", "agreement_id", string="Sections", copy=True) - clauses_ids = fields.One2many( - "agreement.clause", "agreement_id", string="Clauses") + "agreement.section", "agreement_id", string="Sections", copy=True + ) + clauses_ids = fields.One2many("agreement.clause", "agreement_id", string="Clauses") appendix_ids = fields.One2many( - "agreement.appendix", "agreement_id", string="Appendices", copy=True) + "agreement.appendix", "agreement_id", string="Appendices", copy=True + ) previous_version_agreements_ids = fields.One2many( "agreement", "parent_agreement_id", string="Previous Versions", copy=False, - domain=[("active", "=", False)]) + domain=[("active", "=", False)], + ) child_agreements_ids = fields.One2many( "agreement", "parent_agreement_id", string="Child Agreements", copy=False, - domain=[("active", "=", True)]) + domain=[("active", "=", True)], + ) line_ids = fields.One2many( - "agreement.line", - "agreement_id", - string="Products/Services", - copy=False) + "agreement.line", "agreement_id", string="Products/Services", copy=False + ) state = fields.Selection( [("draft", "Draft"), ("active", "Active"), ("inactive", "Inactive")], default="draft", - track_visibility="always") + tracking=True, + ) notification_address_id = fields.Many2one( "res.partner", string="Notification Address", help="The address to send notificaitons to, if different from " - "customer address.(Address Type = Other)") + "customer address.(Address Type = Other)", + ) signed_contract_filename = fields.Char(string="Filename") - signed_contract = fields.Binary( - string="Signed Document", track_visibility="always") + signed_contract = fields.Binary(string="Signed Document", tracking=True) field_id = fields.Many2one( "ir.model.fields", string="Field", help="""Select target field from the related document model. If it is a relationship field you will be able to select a target field at the - destination of the relationship.""") + destination of the relationship.""", + ) sub_object_id = fields.Many2one( "ir.model", string="Sub-model", help="""When a relationship field is selected as first field, this - field shows the document model the relationship goes to.""") + field shows the document model the relationship goes to.""", + ) sub_model_object_field_id = fields.Many2one( "ir.model.fields", string="Sub-field", help="""When a relationship field is selected as first field, this field lets you select the target field within the destination document - model (sub-model).""") + model (sub-model).""", + ) default_value = fields.Char( string="Default Value", - help="Optional value to use if the target field is empty.") + help="Optional value to use if the target field is empty.", + ) copyvalue = fields.Char( string="Placeholder Expression", help="""Final placeholder expression, to be copy-pasted in the desired - template field.""") + template field.""", + ) # compute the dynamic content for mako expression - @api.multi def _compute_dynamic_description(self): MailTemplates = self.env["mail.template"] for agreement in self: lang = agreement.partner_id.lang or "en_US" - description = MailTemplates.with_context( - lang=lang - )._render_template( - agreement.description, "agreement", agreement.id + description = MailTemplates.with_context(lang=lang)._render_template( + agreement.description, "agreement", [agreement.id] ) - agreement.dynamic_description = description + des = "" + for i in description: + des += description[i] + agreement.dynamic_description = des - @api.multi def _compute_dynamic_parties(self): MailTemplates = self.env["mail.template"] for agreement in self: lang = agreement.partner_id.lang or "en_US" - parties = MailTemplates.with_context( - lang=lang - )._render_template( - agreement.parties, "agreement", agreement.id + parties = MailTemplates.with_context(lang=lang)._render_template( + agreement.parties, "agreement", [agreement.id] ) agreement.dynamic_parties = parties - @api.multi def _compute_dynamic_special_terms(self): MailTemplates = self.env["mail.template"] for agreement in self: lang = agreement.partner_id.lang or "en_US" - special_terms = MailTemplates.with_context( - lang=lang - )._render_template( - agreement.special_terms, "agreement", agreement.id + special_terms = MailTemplates.with_context(lang=lang)._render_template( + agreement.special_terms, "agreement", [agreement.id] ) agreement.dynamic_special_terms = special_terms @@ -309,22 +333,26 @@ class Agreement(models.Model): self.sub_object_id = False if self.field_id and not self.field_id.relation: self.copyvalue = "${{object.{} or {}}}".format( - self.field_id.name, self.default_value or "''") + self.field_id.name, self.default_value or "''" + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: self.sub_object_id = self.env["ir.model"].search( - [("model", "=", self.field_id.relation)])[0] + [("model", "=", self.field_id.relation)] + )[0] if self.sub_model_object_field_id: self.copyvalue = "${{object.{}.{} or {}}}".format( self.field_id.name, self.sub_model_object_field_id.name, - self.default_value or "''") + self.default_value or "''", + ) # Used for Kanban grouped_by view @api.model def _read_group_stage_ids(self, stages, domain, order): stage_ids = self.env["agreement.stage"].search( - [('stage_type', '=', 'agreement')]) + [("stage_type", "=", "agreement")] + ) return stage_ids stage_id = fields.Many2one( @@ -332,12 +360,12 @@ class Agreement(models.Model): string="Stage", group_expand="_read_group_stage_ids", help="Select the current stage of the agreement.", - track_visibility="onchange", - index=True) + tracking=True, + index=True, + ) # Create New Version Button - @api.multi - def create_new_version(self, vals): + def create_new_version(self): for rec in self: if not rec.state == "draft": # Make sure status is draft @@ -346,18 +374,18 @@ class Agreement(models.Model): "name": "{} - OLD VERSION".format(rec.name), "active": False, "parent_agreement_id": rec.id, + "version": rec.version, + "code": rec.code + "-V" + str(rec.version), } # Make a current copy and mark it as old rec.copy(default=default_vals) # Increment the Version rec.version = rec.version + 1 - # Reset revision to 0 since it's a new version - vals["revision"] = 0 - return super(Agreement, self).write(vals) def create_new_agreement(self): + self.ensure_one() default_vals = { - "name": "NEW", + "name": "New", "active": True, "version": 1, "revision": 0, @@ -365,7 +393,7 @@ class Agreement(models.Model): "stage_id": self.env.ref("agreement_legal.agreement_stage_new").id, } res = self.copy(default=default_vals) - res.sections_ids.mapped('clauses_ids').write({'agreement_id': res.id}) + res.sections_ids.mapped("clauses_ids").write({"agreement_id": res.id}) return { "res_model": "agreement", "type": "ir.actions.act_window", @@ -377,19 +405,12 @@ class Agreement(models.Model): @api.model def create(self, vals): if vals.get("code", _("New")) == _("New"): - vals["code"] = self.env["ir.sequence"].next_by_code( - "agreement" - ) or _("New") - if not vals.get('stage_id'): - vals["stage_id"] = \ - self.env.ref("agreement_legal.agreement_stage_new").id - return super(Agreement, self).create(vals) + vals["code"] = self.env["ir.sequence"].next_by_code("agreement") or _("New") + if not vals.get("stage_id"): + vals["stage_id"] = self.env.ref("agreement_legal.agreement_stage_new").id + return super().create(vals) # Increments the revision on each save action - @api.multi def write(self, vals): - res = True - for rec in self: - vals["revision"] = rec.revision + 1 - res = super(Agreement, rec).write(vals) - return res + vals["revision"] = self.revision + 1 + return super().write(vals) diff --git a/agreement_legal/models/agreement_appendix.py b/agreement_legal/models/agreement_appendix.py index e81bd53cd..1376cbaf4 100644 --- a/agreement_legal/models/agreement_appendix.py +++ b/agreement_legal/models/agreement_appendix.py @@ -13,21 +13,16 @@ class AgreementAppendix(models.Model): title = fields.Char( string="Title", required=True, - help="The title is displayed on the PDF." "The name is not.", + help="The title is displayed on the PDF. The name is not.", ) - sequence = fields.Integer( - string="Sequence", - default=10) + sequence = fields.Integer(string="Sequence", default=10) content = fields.Html(string="Content") dynamic_content = fields.Html( compute="_compute_dynamic_content", string="Dynamic Content", help="compute dynamic Content", ) - agreement_id = fields.Many2one( - "agreement", - string="Agreement", - ondelete="cascade") + agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade") active = fields.Boolean( string="Active", default=True, @@ -66,27 +61,29 @@ class AgreementAppendix(models.Model): template field.""", ) - @api.onchange('field_id', 'sub_model_object_field_id', 'default_value') + @api.onchange("field_id", "sub_model_object_field_id", "default_value") def onchange_copyvalue(self): self.sub_object_id = False self.copyvalue = False self.sub_object_id = False if self.field_id and not self.field_id.relation: - self.copyvalue = "${object.%s or %s}" % \ - (self.field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{} or {}}}".format( + self.field_id.name, + self.default_value or "''", + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: - self.sub_object_id = self.env['ir.model'].search( - [('model', '=', self.field_id.relation)])[0] + self.sub_object_id = self.env["ir.model"].search( + [("model", "=", self.field_id.relation)] + )[0] if self.sub_model_object_field_id: - self.copyvalue = "${object.%s.%s or %s}" %\ - (self.field_id.name, - self.sub_model_object_field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{}.{} or {}}}".format( + self.field_id.name, + self.sub_model_object_field_id.name, + self.default_value or "''", + ) # compute the dynamic content for mako expression - @api.multi def _compute_dynamic_content(self): MailTemplates = self.env["mail.template"] for appendix in self: @@ -96,6 +93,6 @@ class AgreementAppendix(models.Model): or "en_US" ) content = MailTemplates.with_context(lang=lang)._render_template( - appendix.content, "agreement.appendix", appendix.id + appendix.content, "agreement.appendix", [appendix.id] ) appendix.dynamic_content = content diff --git a/agreement_legal/models/agreement_clause.py b/agreement_legal/models/agreement_clause.py index e7ab066fa..ecae7af24 100644 --- a/agreement_legal/models/agreement_clause.py +++ b/agreement_legal/models/agreement_clause.py @@ -11,27 +11,25 @@ class AgreementClause(models.Model): name = fields.Char(string="Name", required=True) title = fields.Char( - string="Title", - help="The title is displayed on the PDF." "The name is not.") + string="Title", help="The title is displayed on the PDF. The name is not." + ) sequence = fields.Integer(string="Sequence") - agreement_id = fields.Many2one( - "agreement", - string="Agreement", - ondelete="cascade") + agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade") section_id = fields.Many2one( - "agreement.section", - string="Section", - ondelete="cascade") + "agreement.section", string="Section", ondelete="cascade" + ) content = fields.Html(string="Clause Content") dynamic_content = fields.Html( compute="_compute_dynamic_content", string="Dynamic Content", - help="compute dynamic Content") + help="compute dynamic Content", + ) active = fields.Boolean( string="Active", default=True, help="If unchecked, it will allow you to hide the agreement without " - "removing it.") + "removing it.", + ) # Dynamic field editor field_id = fields.Many2one( @@ -39,56 +37,61 @@ class AgreementClause(models.Model): string="Field", help="""Select target field from the related document model. If it is a relationship field you will be able to select a target field at the - destination of the relationship.""") + destination of the relationship.""", + ) sub_object_id = fields.Many2one( "ir.model", string="Sub-model", help="""When a relationship field is selected as first field, this - field shows the document model the relationship goes to.""") + field shows the document model the relationship goes to.""", + ) sub_model_object_field_id = fields.Many2one( "ir.model.fields", string="Sub-field", help="""When a relationship field is selected as first field, this field lets you select the target field within the destination document - model (sub-model).""") + model (sub-model).""", + ) default_value = fields.Char( string="Default Value", - help="Optional value to use if the target field is empty.") + help="Optional value to use if the target field is empty.", + ) copyvalue = fields.Char( string="Placeholder Expression", help="""Final placeholder expression, to be copy-pasted in the desired - template field.""") + template field.""", + ) - @api.onchange('field_id', 'sub_model_object_field_id', 'default_value') + @api.onchange("field_id", "sub_model_object_field_id", "default_value") def onchange_copyvalue(self): self.sub_object_id = False self.copyvalue = False self.sub_object_id = False if self.field_id and not self.field_id.relation: - self.copyvalue = "${object.%s or %s}" % \ - (self.field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{} or {}}}".format( + self.field_id.name, + self.default_value or "''", + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: - self.sub_object_id = self.env['ir.model'].search( - [('model', '=', self.field_id.relation)])[0] + self.sub_object_id = self.env["ir.model"].search( + [("model", "=", self.field_id.relation)] + )[0] if self.sub_model_object_field_id: - self.copyvalue = "${object.%s.%s or %s}" %\ - (self.field_id.name, - self.sub_model_object_field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{}.{} or {}}}".format( + self.field_id.name, + self.sub_model_object_field_id.name, + self.default_value or "''", + ) # compute the dynamic content for mako expression - @api.multi def _compute_dynamic_content(self): MailTemplates = self.env["mail.template"] for clause in self: lang = ( - clause.agreement_id - and clause.agreement_id.partner_id.lang - or "en_US" + clause.agreement_id and clause.agreement_id.partner_id.lang or "en_US" ) content = MailTemplates.with_context(lang=lang)._render_template( - clause.content, "agreement.clause", clause.id + clause.content, "agreement.clause", [clause.id] ) clause.dynamic_content = content diff --git a/agreement_legal/models/agreement_increasetype.py b/agreement_legal/models/agreement_increasetype.py index 094168c15..e3fc62f3f 100644 --- a/agreement_legal/models/agreement_increasetype.py +++ b/agreement_legal/models/agreement_increasetype.py @@ -17,11 +17,8 @@ class AgreementIncreaseType(models.Model): "the contract.", ) description = fields.Text( - string="Description", - required=True, - help="Description of the renewal type." + string="Description", required=True, help="Description of the renewal type." ) increase_percent = fields.Integer( - string="Increase Percentage", - help="Percentage that the amount will increase." + string="Increase Percentage", help="Percentage that the amount will increase." ) diff --git a/agreement_legal/models/agreement_line.py b/agreement_legal/models/agreement_line.py index 3960681f3..99e62b516 100644 --- a/agreement_legal/models/agreement_line.py +++ b/agreement_legal/models/agreement_line.py @@ -8,21 +8,11 @@ class AgreementLine(models.Model): _name = "agreement.line" _description = "Agreement Lines" - product_id = fields.Many2one( - "product.product", - string="Product") - name = fields.Char( - string="Description", - required=True) - agreement_id = fields.Many2one( - "agreement", - string="Agreement", - ondelete="cascade") + product_id = fields.Many2one("product.product", string="Product") + name = fields.Char(string="Description", required=True) + agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade") qty = fields.Float(string="Quantity") - uom_id = fields.Many2one( - "uom.uom", - string="Unit of Measure", - required=True) + uom_id = fields.Many2one("uom.uom", string="Unit of Measure", required=True) @api.onchange("product_id") def _onchange_product_id(self): diff --git a/agreement_legal/models/agreement_recital.py b/agreement_legal/models/agreement_recital.py index 15b045170..7fec94a4d 100644 --- a/agreement_legal/models/agreement_recital.py +++ b/agreement_legal/models/agreement_recital.py @@ -21,9 +21,7 @@ class AgreementRecital(models.Model): string="Dynamic Content", help="compute dynamic Content", ) - agreement_id = fields.Many2one( - "agreement", string="Agreement", ondelete="cascade" - ) + agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade") active = fields.Boolean( string="Active", default=True, @@ -84,16 +82,13 @@ class AgreementRecital(models.Model): ) # compute the dynamic content for mako expression - @api.multi def _compute_dynamic_content(self): MailTemplates = self.env["mail.template"] for recital in self: lang = ( - recital.agreement_id - and recital.agreement_id.partner_id.lang - or "en_US" + recital.agreement_id and recital.agreement_id.partner_id.lang or "en_US" ) content = MailTemplates.with_context(lang=lang)._render_template( - recital.content, "agreement.recital", recital.id + recital.content, "agreement.recital", [recital.id] ) recital.dynamic_content = content diff --git a/agreement_legal/models/agreement_renewaltype.py b/agreement_legal/models/agreement_renewaltype.py index ee03893c8..fd8694e3c 100644 --- a/agreement_legal/models/agreement_renewaltype.py +++ b/agreement_legal/models/agreement_renewaltype.py @@ -17,7 +17,5 @@ class AgreementRenewalType(models.Model): "agreement/contract expires.", ) description = fields.Text( - string="Description", - required=True, - help="Description of the renewal type." + string="Description", required=True, help="Description of the renewal type." ) diff --git a/agreement_legal/models/agreement_section.py b/agreement_legal/models/agreement_section.py index 2d9220dff..b4c275111 100644 --- a/agreement_legal/models/agreement_section.py +++ b/agreement_legal/models/agreement_section.py @@ -11,23 +11,25 @@ class AgreementSection(models.Model): name = fields.Char(string="Name", required=True) title = fields.Char( - string="Title", - help="The title is displayed on the PDF. The name is not.") + string="Title", help="The title is displayed on the PDF. The name is not." + ) sequence = fields.Integer(string="Sequence") - agreement_id = fields.Many2one( - "agreement", string="Agreement", ondelete="cascade") + agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade") clauses_ids = fields.One2many( - "agreement.clause", "section_id", string="Clauses", copy=True) + "agreement.clause", "section_id", string="Clauses", copy=True + ) content = fields.Html(string="Section Content") dynamic_content = fields.Html( compute="_compute_dynamic_content", string="Dynamic Content", - help="compute dynamic Content") + help="compute dynamic Content", + ) active = fields.Boolean( string="Active", default=True, help="If unchecked, it will allow you to hide the agreement without " - "removing it.") + "removing it.", + ) # Dynamic field editor field_id = fields.Many2one( @@ -35,25 +37,30 @@ class AgreementSection(models.Model): string="Field", help="""Select target field from the related document model. If it is a relationship field you will be able to select a target field at the - destination of the relationship.""") + destination of the relationship.""", + ) sub_object_id = fields.Many2one( "ir.model", string="Sub-model", help="""When a relationship field is selected as first field, this - field shows the document model the relationship goes to.""") + field shows the document model the relationship goes to.""", + ) sub_model_object_field_id = fields.Many2one( "ir.model.fields", string="Sub-field", help="""When a relationship field is selected as first field, this field lets you select the target field within the destination document - model (sub-model).""") + model (sub-model).""", + ) default_value = fields.Char( string="Default Value", - help="Optional value to use if the target field is empty.") + help="Optional value to use if the target field is empty.", + ) copyvalue = fields.Char( string="Placeholder Expression", help="""Final placeholder expression, to be copy-pasted in the desired - template field.""") + template field.""", + ) @api.onchange("field_id", "sub_model_object_field_id", "default_value") def onchange_copyvalue(self): @@ -62,7 +69,8 @@ class AgreementSection(models.Model): self.sub_object_id = False if self.field_id and not self.field_id.relation: self.copyvalue = "${{object.{} or {}}}".format( - self.field_id.name, self.default_value or "''") + self.field_id.name, self.default_value or "''" + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: self.sub_object_id = self.env["ir.model"].search( @@ -76,12 +84,13 @@ class AgreementSection(models.Model): ) # compute the dynamic content for mako expression - @api.multi def _compute_dynamic_content(self): MailTemplates = self.env["mail.template"] for section in self: - lang = (section.agreement_id and - section.agreement_id.partner_id.lang or "en_US") + lang = ( + section.agreement_id and section.agreement_id.partner_id.lang or "en_US" + ) content = MailTemplates.with_context(lang=lang)._render_template( - section.content, "agreement.section", section.id) + section.content, "agreement.section", [section.id] + ) section.dynamic_content = content diff --git a/agreement_legal/models/agreement_stage.py b/agreement_legal/models/agreement_stage.py index 2c42106f2..874c2d0b4 100644 --- a/agreement_legal/models/agreement_stage.py +++ b/agreement_legal/models/agreement_stage.py @@ -11,21 +11,14 @@ class AgreementStage(models.Model): _order = "sequence" # General - name = fields.Char( - string="Stage Name", - required=True) - description = fields.Text( - string="Description", - required=False) - sequence = fields.Integer( - string="Sequence", - default="1", - required=False) + name = fields.Char(string="Stage Name", required=True) + description = fields.Text(string="Description", required=False) + sequence = fields.Integer(string="Sequence", default="1", required=False) fold = fields.Boolean( string="Is Folded", required=False, help="This stage is folded in the kanban view by default.", ) stage_type = fields.Selection( - [('agreement', 'Agreement')], - string='Type', required=True) + [("agreement", "Agreement")], string="Type", required=True + ) diff --git a/agreement_legal/models/agreement_subtype.py b/agreement_legal/models/agreement_subtype.py index 961be0883..056c061f1 100644 --- a/agreement_legal/models/agreement_subtype.py +++ b/agreement_legal/models/agreement_subtype.py @@ -9,6 +9,4 @@ class AgreementSubtype(models.Model): _description = "Agreement Subtypes" name = fields.Char(string="Name", required=True) - agreement_type_id = fields.Many2one( - "agreement.type", - string="Agreement Type") + agreement_type_id = fields.Many2one("agreement.type", string="Agreement Type") diff --git a/agreement_legal/models/agreement_type.py b/agreement_legal/models/agreement_type.py index 13fc862a2..20df56b73 100644 --- a/agreement_legal/models/agreement_type.py +++ b/agreement_legal/models/agreement_type.py @@ -9,7 +9,5 @@ class AgreementType(models.Model): _description = "Agreement Types" agreement_subtypes_ids = fields.One2many( - "agreement.subtype", - "agreement_type_id", - string="Subtypes" + "agreement.subtype", "agreement_type_id", string="Subtypes" ) diff --git a/agreement_legal/models/product_template.py b/agreement_legal/models/product_template.py index 3c3b6e9ee..9cf9e2e34 100644 --- a/agreement_legal/models/product_template.py +++ b/agreement_legal/models/product_template.py @@ -7,6 +7,4 @@ from odoo import fields, models class Product(models.Model): _inherit = "product.template" - agreements_ids = fields.Many2many( - "agreement", - string="Agreements") + agreements_ids = fields.Many2many("agreement", string="Agreements") diff --git a/agreement_legal/models/res_config_settings.py b/agreement_legal/models/res_config_settings.py index 63b9205b3..63de86be9 100644 --- a/agreement_legal/models/res_config_settings.py +++ b/agreement_legal/models/res_config_settings.py @@ -19,8 +19,7 @@ class ResConfigSettings(models.TransientModel): module_agreement_repair = fields.Boolean( string="Link your repair orders to an agreement." ) - module_agreement_rma = fields.Boolean( - string="Link your RMAs to an agreement.") + module_agreement_rma = fields.Boolean(string="Link your RMAs to an agreement.") module_agreement_sale = fields.Boolean( string="Create an agreement when the sale order is confirmed." ) diff --git a/agreement_legal/models/res_partner.py b/agreement_legal/models/res_partner.py index 66f42bce7..896c7b0ad 100644 --- a/agreement_legal/models/res_partner.py +++ b/agreement_legal/models/res_partner.py @@ -7,7 +7,4 @@ from odoo import fields, models class Partner(models.Model): _inherit = "res.partner" - agreement_ids = fields.One2many( - "agreement", - "partner_id", - string="Agreements") + agreement_ids = fields.One2many("agreement", "partner_id", string="Agreements") diff --git a/agreement_legal/report/agreement.xml b/agreement_legal/report/agreement.xml index 6a621d0fb..a2b9b5337 100644 --- a/agreement_legal/report/agreement.xml +++ b/agreement_legal/report/agreement.xml @@ -1,21 +1,20 @@ - - + + Agreement + agreement + qweb-pdf + agreement_legal.report_agreement_document + agreement_legal.report_agreement_document + - + + Agreement Preview + agreement + qweb-html + agreement_legal.report_agreement_document + agreement_legal.report_agreement_document +