[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
This commit is contained in:
Patrick Wilson
2021-05-04 11:38:03 -06:00
parent 1205bb7717
commit 5736d92ace
52 changed files with 2065 additions and 898 deletions

View File

@@ -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

View File

@@ -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"],
}

View File

@@ -1,4 +1,3 @@
<?xml version="1.0"?>
<odoo>
<record id="agreement_stage_new" model="agreement.stage">

View File

@@ -1,4 +1,3 @@
<?xml version="1.0"?>
<odoo>
<record id="agreement_type_agreement" model="agreement.type">

View File

@@ -1,146 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2019 Ygol Internetwork (yves@ygol.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market1')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market1')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market1" model="agreement">
<field name="description">Hardware IT (C2C-IT0042)</field>
<field name="agreement_type_id">1</field>
<field name="agreement_type_id" ref="agreement_type_agreement" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market1')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market1')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market2')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market2')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market2" model="agreement">
<field name="description">Fiber access office Lausanne (C2C-IT0043)</field>
<field name="agreement_type_id">2</field>
<field name="agreement_type_id" ref="agreement_type_contract" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market2')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market2')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market3')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market3')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market3" model="agreement">
<field name="description">Vétérinaire (AGR-VETO001)</field>
<field name="agreement_type_id">3</field>
<field name="agreement_type_id" ref="agreement_type_loi" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market3')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market3')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market4')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market4')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market4" model="agreement">
<field name="description">Wazo IPBX deployment and maintenance (AGR-TEL001)</field>
<field name="agreement_type_id">3</field>
<field
name="description"
>Wazo IPBX deployment and maintenance (AGR-TEL001)</field>
<field name="agreement_type_id" ref="agreement_type_loi" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market4')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market4')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market5')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market5')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market5" model="agreement">
<field name="description">SIP Phones supply (BUY-VOIP012)</field>
<field name="agreement_type_id">1</field>
<field name="agreement_type_id" ref="agreement_type_loi" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market5')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market5')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market6')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market6')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="agreement.market6" model="agreement">
<field name="description">SIP-ISDN gateways (BUY-VOIP013)</field>
<field name="agreement_type_id">2</field>
<field name="agreement_type_id" ref="agreement_type_contract" />
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'agreement'), ('name', '=', 'market6')]"
/>
<value eval="[('module', '=', 'agreement'), ('name', '=', 'market6')]" />
</function>
<value eval="{'noupdate': True}" />
</function>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<!-- Sequence for agreement -->

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="agreement" model="ir.module.category">

View File

@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2019 Ygol Internetwork (yves@ygol.com)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="agreement.market1" model="agreement">
@@ -22,7 +20,9 @@
</record>
<record id="agreement.market4" model="agreement">
<field name="description">Wazo IPBX deployment and maintenance (AGR-TEL001)</field>
<field
name="description"
>Wazo IPBX deployment and maintenance (AGR-TEL001)</field>
<field name="agreement_type_id" ref="agreement_type_loi" />
</record>

View File

@@ -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 <remi@le-filament.com>\n"
"PO-Revision-Date: 2019-09-12 11:23+0000\n"
"Last-Translator: Yves Goldberg <admin@ygol.com>\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

View File

@@ -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"

View File

@@ -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 <britoederr@gmail.com>\n"
"PO-Revision-Date: 2020-08-10 16:59+0000\n"
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\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

View File

@@ -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"

View File

@@ -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 "协议"

View File

@@ -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;")

View File

@@ -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)

View File

@@ -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.copyvalue = "${{object.{}.{} or {}}}".format(
self.field_id.name,
self.sub_model_object_field_id.name,
self.default_value or '\'\'')
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

View File

@@ -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.copyvalue = "${{object.{}.{} or {}}}".format(
self.field_id.name,
self.sub_model_object_field_id.name,
self.default_value or '\'\'')
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

View File

@@ -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."
)

View File

@@ -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):

View File

@@ -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

View File

@@ -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."
)

View File

@@ -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

View File

@@ -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
)

View File

@@ -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")

View File

@@ -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"
)

View File

@@ -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")

View File

@@ -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."
)

View File

@@ -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")

View File

@@ -1,21 +1,20 @@
<?xml version="1.0"?>
<odoo>
<report
id="partner_agreement_contract_document"
model="agreement"
string="Contract Document"
name="agreement_legal.report_agreement_document"
file="agreement_legal.report_agreement_document"
report_type="qweb-pdf"/>
<record id="partner_agreement_contract_document" model="ir.actions.report">
<field name="name">Agreement</field>
<field name="model">agreement</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">agreement_legal.report_agreement_document</field>
<field name="report_file">agreement_legal.report_agreement_document</field>
</record>
<report
id="partner_agreement_contract_document_preview"
model="agreement"
string="Contract Document Preview"
name="agreement_legal.report_agreement_document"
file="agreement_legal.report_agreement_document"
report_type="qweb-html"/>
<record id="partner_agreement_contract_document_preview" model="ir.actions.report">
<field name="name">Agreement Preview</field>
<field name="model">agreement</field>
<field name="report_type">qweb-html</field>
<field name="report_name">agreement_legal.report_agreement_document</field>
<field name="report_file">agreement_legal.report_agreement_document</field>
</record>
<template id="report_agreement_document">
<t t-name="agreement.report_agreement_document">
@@ -36,19 +35,27 @@
<t t-if="not doc.use_parties_content">
<h3>Company Information</h3>
<div name="company_address">
<address t-field="doc.company_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<address
t-field="doc.company_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
/>
</div>
<div name="company_contact">
Represented by <span t-field="doc.company_contact_id.name"/>.
Represented by <span
t-field="doc.company_contact_id.name"
/>.
</div>
<h3>Partner Information</h3>
<div name="partner_address">
<address t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<address
t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
/>
</div>
<div name="partner_contact">
Represented by <span t-field="doc.partner_contact_id.name"/>.
Represented by <span
t-field="doc.partner_contact_id.name"
/>.
</div>
</t>
<h2>Agreement</h2>
@@ -58,7 +65,10 @@
<tr>
<td>
<ol>
<li t-foreach="doc.recital_ids" t-as="r">
<li
t-foreach="doc.recital_ids"
t-as="r"
>
<t t-if="r.title">
<h3 t-field="r.title" />
</t>
@@ -74,17 +84,25 @@
<tr>
<td>
<ol>
<li t-foreach="doc.sections_ids" t-as="s">
<li
t-foreach="doc.sections_ids"
t-as="s"
>
<t t-if="s.title">
<h3 t-field="s.title" />
</t>
<p t-field="s.dynamic_content" />
<ol>
<li t-foreach="s.clauses_ids" t-as="c">
<li
t-foreach="s.clauses_ids"
t-as="c"
>
<t t-if="c.title">
<h4 t-field="c.title" />
</t>
<p t-field="c.dynamic_content"/>
<p
t-field="c.dynamic_content"
/>
</li>
</ol>
</li>
@@ -113,10 +131,14 @@
<p t-field="doc.partner_id" />
<p>By: </p>
<p>
Name: <span t-field="doc.partner_contact_id.name"/>
Name: <span
t-field="doc.partner_contact_id.name"
/>
</p>
<p>
Title: <span t-field="doc.partner_contact_id.function"/>
Title: <span
t-field="doc.partner_contact_id.function"
/>
</p>
<p>Date: </p>
</td>
@@ -124,10 +146,14 @@
<p t-field="doc.company_id.partner_id" />
<p>By: </p>
<p>
Name: <span t-field="doc.company_contact_id.name"/>
Name: <span
t-field="doc.company_contact_id.name"
/>
</p>
<p>
Title: <span t-field="doc.company_contact_id.function"/>
Title: <span
t-field="doc.company_contact_id.function"
/>
</p>
<p>Date: </p>
</td>
@@ -137,8 +163,10 @@
</div>
<div t-foreach="doc.appendix_ids" t-as="a">
<div class="page">
<h1 t-field="a.title"
style="page-break-before: always;"/>
<h1
t-field="a.title"
style="page-break-before: always;"
/>
<p t-field="a.dynamic_content" />
</div>
</div>

View File

@@ -9,7 +9,10 @@
<record id="group_agreement_readonly" model="res.groups">
<field name="name">Read-Only Users</field>
<field name="category_id" ref="module_agreement_legal_category" />
<field name="implied_ids" eval="[(4, ref('base.group_user')), (4, ref('agreement.group_use_agreement_type')), (4, ref('agreement.group_use_agreement_template'))]"/>
<field
name="implied_ids"
eval="[(4, ref('base.group_user')), (4, ref('agreement.group_use_agreement_type')), (4, ref('agreement.group_use_agreement_template'))]"
/>
</record>
<!-- User group -->
@@ -24,7 +27,10 @@
<field name="name">Manager</field>
<field name="category_id" ref="module_agreement_legal_category" />
<field name="implied_ids" eval="[(4, ref('group_agreement_user'))]" />
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
<field
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>
</odoo>

View File

@@ -0,0 +1,85 @@
odoo.define("agreement_legal.domain_widget_ext", function (require) {
"use strict";
var basic_fields = require("web.basic_fields");
var DomainSelector = require("web.DomainSelector");
var session = require("web.session");
var core = require("web.core");
var qweb = core.qweb;
basic_fields.FieldDomain.include({
/**
* Init
*/
init: function () {
this._super.apply(this, arguments);
// Add Additional options
this.partialUse = this.nodeOptions.partial_use || false;
},
// ----------------------------------------------------------------------
// Private
// ----------------------------------------------------------------------
/**
* @private
* @override _render from AbstractField
* @returns {Deferred}
*/
_render: function () {
// If there is no model, only change the non-domain-selector content
if (!this._domainModel) {
this._replaceContent();
return $.when();
}
// Convert char value to array value
var value = this.value || "[]";
// Create the domain selector or change the value of the current
// one...
var def = null;
if (this.domainSelector) {
def = this.domainSelector.setDomain(value);
} else {
this.domainSelector = new DomainSelector(
this,
this._domainModel,
value,
{
readonly: this.mode === "readonly" || this.inDialog,
filters: this.fsFilters,
debugMode: session.debug,
partialUse: this.partialUse || false,
}
);
def = this.domainSelector.prependTo(this.$el);
}
// ... then replace the other content (matched records, etc)
return def.then(this._replaceContent.bind(this));
},
/**
* Render the field DOM except for the domain selector part. The full
* field DOM is composed of a DIV which contains the domain selector
* widget, followed by other content. This other content is handled by
* this method.
*
* @private
*/
_replaceContent: function () {
if (this._$content) {
this._$content.remove();
}
this._$content = $(
qweb.render("FieldDomain.content", {
hasModel: Boolean(this._domainModel),
isValid: Boolean(this._isValidForModel),
nbRecords: this.record.specialData[this.name].nbRecords || 0,
inDialogEdit: this.inDialog && this.mode === "edit",
partialUse: this.partialUse || false,
})
);
this._$content.appendTo(this.$el);
},
});
});

View File

@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-name="FieldDomain.content">
<t t-if="partialUse">
<div t-if="hasModel" class="o_field_domain_panel">
</div>
</t>
<t t-if="!partialUse">
<div t-if="hasModel" class="o_field_domain_panel">
<i
class="fa fa-arrow-right"
role="img"
aria-label="Domain"
title="Domain"
/>
<button
t-if="isValid"
class="btn btn-sm btn-secondary o_domain_show_selection_button"
type="button"
>
<t t-esc="nbRecords" /> record(s)
</button>
<span t-else="" class="text-warning" role="alert"><i
class="fa fa-exclamation-triangle"
role="img"
aria-label="Warning"
title="Warning"
/> Invalid domain</span>
<button
t-if="inDialogEdit"
class="btn btn-sm btn-primary o_field_domain_dialog_button"
>Edit Domain</button>
</div>
<div t-else="">Select a model to add a filter.</div>
</t>
</t>
<div
aria-atomic="true"
t-name="DomainSelector"
t-attf-class="o_domain_node o_domain_tree o_domain_selector #{widget.readonly ? 'o_read_mode' : 'o_edit_mode'}"
>
<t t-if="widget.options.partialUse">
<t t-if="widget.children.length === 0">
<span>SMatch <strong>all records</strong></span>
<button
t-if="!widget.readonly"
class="btn btn-sm btn-primary o_domain_add_first_node_button"
><i class="fa fa-plus" /> Add filter</button>
</t>
<t t-else="">
<div class="o_domain_tree_header">
<t
t-if="widget.children.length === 1"
>Please navigate below and select field:</t>
<t t-else="">
<span>SSMatch records with</span>
<t t-call="DomainTree.OperatorSelector" />
<span>of the following rules:</span>
</t>
</div>
<div class="o_domain_node_children_container" />
</t>
</t>
<t t-if="!widget.options.partialUse">
<t t-if="widget.children.length === 0">
<span>Match <strong>all records</strong></span>
<button
t-if="!widget.readonly"
class="btn btn-sm btn-primary o_domain_add_first_node_button"
><i class="fa fa-plus" /> Add filter</button>
</t>
<t t-else="">
<div class="o_domain_tree_header">
<t
t-if="widget.children.length === 1"
>Match records with the following rule:</t>
<t t-else="">
<span>Match records with</span>
<t t-call="DomainTree.OperatorSelector" />
<span>of the following rules:</span>
</t>
</div>
<div class="o_domain_node_children_container" />
</t>
<label
t-if="widget.debug &amp;&amp; !widget.readonly"
class="o_domain_debug_container"
>
<span class="small"># Code editor</span>
<input type="text" class="o_domain_debug_input" />
</label>
</t>
</div>
<t t-name="DomainNode.ControlPanel">
<t t-if="widget.options.partialUse">
<div
t-if="!widget.readonly &amp;&amp; !widget.noControlPanel"
class="o_domain_node_control_panel"
role="toolbar"
aria-label="Domain node"
>
</div>
</t>
<t t-if="!widget.options.partialUse">
<div
t-if="!widget.readonly &amp;&amp; !widget.noControlPanel"
class="o_domain_node_control_panel"
role="toolbar"
aria-label="Domain node"
>
<button
class="btn o_domain_delete_node_button"
title="Delete node"
aria-label="Delete node"
><i class="fa fa-times" /></button>
<button
class="btn o_domain_add_node_button"
title="Add node"
aria-label="Add node"
><i class="fa fa-plus-circle" /></button>
<button
class="btn o_domain_add_node_button"
title="Add branch"
aria-label="Add branch"
data-branch="1"
><i class="fa fa-ellipsis-h" /></button>
</div>
</t>
</t>
<div
t-name="DomainLeaf"
t-attf-class="o_domain_node o_domain_leaf o_domain_selector_row #{widget.readonly ? 'o_read_mode' : 'o_edit_mode'}"
>
<t t-call="DomainNode.ControlPanel" />
<div t-if="!widget.readonly" class="o_domain_leaf_edition">
<!-- field selector will be instantiated here -->
<t t-if="!widget.options.partialUse">
<div> <!-- used for flex stretching -->
<select class="o_domain_leaf_operator_select o_input">
<option
t-foreach="widget.operators"
t-as="key"
t-att-value="key"
t-att-selected="widget.displayOperator === key ? 'selected' : None"
>
<t t-esc="key_value" />
</option>
</select>
</div>
<div
t-attf-class="o_ds_value_cell#{_.contains(['set', 'not set'], widget.displayOperator) ? ' d-none' : ''}"
>
<t t-if="widget.selectionChoices !== null">
<select class="o_domain_leaf_value_input o_input">
<option
t-foreach="widget.selectionChoices"
t-as="val"
t-att-value="val[0]"
t-att-selected="_.contains(val, widget.displayValue) ? 'selected' : None"
>
<t t-esc="val[1]" />
</option>
</select>
</t>
<t t-else="">
<t t-if="_.contains(['in', 'not in'], widget.operator)">
<div class="o_domain_leaf_value_input">
<span
class="badge badge-pill"
t-foreach="widget.displayValue"
t-as="val"
>
<t t-esc="val" /> <i
class="o_domain_leaf_value_remove_tag_button fa fa-times"
t-att-data-value="val"
role="img"
aria-label="Remove tag"
title="Remove tag"
/>
</span>
</div>
<div class="o_domain_leaf_value_tags">
<input
placeholder="Add new value"
type="text"
class="o_input"
/>
<button
class="btn btn-sm btn-primary fa fa-plus o_domain_leaf_value_add_tag_button"
aria-label="Add tag"
title="Add tag"
/>
</div>
</t>
<t t-else="">
<input
class="o_domain_leaf_value_input o_input"
type="text"
t-att-value="widget.displayValue"
/>
</t>
</t>
</div>
</t>
</div>
<div t-else="" class="o_domain_leaf_info">
<!-- field selector will be instantiated here -->
<t t-if="_.isString(widget.value)">
<span class="o_domain_leaf_operator"><t
t-esc="widget.operator_mapping[widget.operator]"
/></span>
<span class="o_domain_leaf_value text-primary">"<t
t-esc="widget.value"
/>"</span>
</t>
<t t-if="_.isArray(widget.value)">
<span class="o_domain_leaf_operator"><t
t-esc="widget.operator_mapping[widget.operator]"
/></span>
<t t-foreach="widget.value" t-as="v">
<span class="o_domain_leaf_value text-primary">"<t
t-esc="v"
/>"</span>
<t t-if="!v_last"> or </t>
</t>
</t>
<t t-if="_.isNumber(widget.value)">
<span class="o_domain_leaf_operator"><t
t-esc="widget.operator_mapping[widget.operator]"
/></span>
<span class="o_domain_leaf_value text-primary"><t
t-esc="widget.value"
/></span>
</t>
<t t-if="_.isBoolean(widget.value)">
is
<t
t-if="widget.operator === '=' &amp;&amp; widget.value === false || widget.operator === '!=' &amp;&amp; widget.value === true"
>not</t>
set
</t>
</div>
</div>
<div
aria-atomic="true"
t-name="ModelFieldSelector"
t-attf-class="o_field_selector#{!widget.options.readonly ? ' o_edit_mode o_input' : ''}"
>
<div class="o_field_selector_value" tabindex="0" />
<t t-if="!widget.options.partialUse">
<div class="o_field_selector_controls" tabindex="0">
<i
role="alert"
class="fa fa-exclamation-triangle o_field_selector_warning d-none"
title="Invalid field chain"
aria-label="Invalid field chain"
/>
</div>
</t>
<div
t-if="!widget.options.readonly"
class="o_field_selector_popover d-none"
tabindex="0"
>
<div class="o_field_selector_popover_header text-center">
<i
class="fa fa-arrow-left o_field_selector_popover_option o_field_selector_prev_page"
title="Previous"
role="img"
aria-label="Previous"
/>
<div class="o_field_selector_title" />
<i
class="fa fa-times o_field_selector_popover_option o_field_selector_close"
title="Close"
role="img"
aria-label="Close"
/>
</div>
<div class="o_field_selector_popover_body">
<ul class="o_field_selector_page" />
</div>
<div
t-if="widget.options.debugMode"
class="o_field_selector_popover_footer"
>
<input type="text" class="o_input" />
</div>
</div>
</div>
</templates>

View File

@@ -0,0 +1,8 @@
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
from . import test_agreement
from . import test_agreement_appendix
from . import test_agreement_clause
from . import test_agreement_line
from . import test_agreement_recital
from . import test_agreement_section

View File

@@ -0,0 +1,131 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreement(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
"state": "active",
}
)
# TEST 01: Set 'Field' for dynamic placeholder, test onchange method
def test_onchange_copyvalue(self):
agreement_01 = self.test_agreement
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "active"),
]
)
agreement_01.field_id = field_01.id
agreement_01.onchange_copyvalue()
self.assertEqual(agreement_01.copyvalue, "${object.active or ''}")
# TEST 02: Set related 'Field' for dynamic placeholder to
# test onchange method
def test_onchange_copyvalue2(self):
agreement_01 = self.test_agreement
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "agreement_type_id"),
]
)
sub_field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.type"),
("name", "=", "active"),
]
)
agreement_01.field_id = field_01.id
agreement_01.onchange_copyvalue()
self.assertEqual(agreement_01.sub_object_id.model, "agreement.type")
agreement_01.sub_model_object_field_id = sub_field_01.id
agreement_01.onchange_copyvalue()
self.assertEqual(
agreement_01.copyvalue, "${object.agreement_type_id.active or ''}"
)
# TEST 03: Create New Version
def test_create_new_version(self):
agreement_01 = self.test_agreement
agreement_01.create_new_version()
old_agreement = self.env["agreement"].search(
[
("code", "=", agreement_01.code + "-V1"),
("active", "=", False),
]
)
self.assertEqual(len(old_agreement), 1)
new_agreement = self.env["agreement"].search(
[
("name", "=", "TestAgreement"),
("version", "=", 2),
]
)
self.assertEqual(len(new_agreement), 1)
# TEST 04: Create New Agreement
def test_create_new_agreement(self):
agreement_01 = self.test_agreement
agreement_01.create_new_agreement()
new_agreement = self.env["agreement"].search([("name", "=", "New")])
self.assertEqual(len(new_agreement), 1)
# TEST 05: Test Description Dynamic Field
def test_compute_dynamic_description(self):
agreement_01 = self.test_agreement
agreement_01.description = "${object.name}"
self.assertEqual(
agreement_01.dynamic_description,
"TestAgreement",
)
# TEST 06: Test Parties Dynamic Field
def test_compute_dynamic_parties(self):
agreement_01 = self.test_agreement
agreement_01.parties = "${object.name}"
self.assertEqual(
agreement_01.dynamic_parties,
"<p>{" + str(agreement_01.id) + ": '</p><p>TestAgreement</p>'}",
)
# TEST 07: Test Special Terms Dynamic Field
def test_compute_dynamic_special_terms(self):
agreement_01 = self.test_agreement
agreement_01.special_terms = "${object.name}"
self.assertEqual(
agreement_01.dynamic_special_terms,
"{" + str(agreement_01.id) + ": 'TestAgreement'}",
)
# TEST 02: Check Read Stages
def test_read_group_stage_ids(self):
agreement_01 = self.test_agreement
self.assertEqual(
agreement_01._read_group_stage_ids(self.env["agreement.stage"], [], "id"),
self.env["agreement.stage"].search(
[("stage_type", "=", "agreement")],
order="id",
),
)

View File

@@ -0,0 +1,81 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreementAppendices(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_appendices = self.env["agreement.appendix"].create(
{
"name": "TestAppendices",
"title": "Test",
"content": "Test",
"agreement_id": self.test_agreement.id,
}
)
# TEST 01: Set 'Field' for dynamic placeholder, test onchange method
def test_onchange_copyvalue(self):
appendix_01 = self.test_appendices
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.appendix"),
("name", "=", "active"),
]
)
appendix_01.field_id = field_01.id
appendix_01.onchange_copyvalue()
self.assertEqual(appendix_01.copyvalue, "${object.active or ''}")
# TEST 02: Set related 'Field' for dynamic placeholder to
# test onchange method
def test_onchange_copyvalue2(self):
appendix_01 = self.test_appendices
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.appendix"),
("name", "=", "agreement_id"),
]
)
sub_field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "active"),
]
)
appendix_01.field_id = field_01.id
appendix_01.onchange_copyvalue()
self.assertEqual(appendix_01.sub_object_id.model, "agreement")
appendix_01.sub_model_object_field_id = sub_field_01.id
appendix_01.onchange_copyvalue()
self.assertEqual(appendix_01.copyvalue, "${object.agreement_id.active or ''}")
# TEST 03: Test Dynamic Field
def test_compute_dynamic_content(self):
appendix_01 = self.test_appendices
appendix_01.content = "${object.name}"
self.assertEqual(
appendix_01.dynamic_content,
"<p>{" + str(appendix_01.id) + ": '</p><p>TestAppendices</p>'}",
)

View File

@@ -0,0 +1,81 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreementClauses(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_clause = self.env["agreement.clause"].create(
{
"name": "TestClause",
"title": "Test",
"content": "Test",
"agreement_id": self.test_agreement.id,
}
)
# TEST 01: Set 'Field' for dynamic placeholder, test onchange method
def test_onchange_copyvalue(self):
clause_01 = self.test_clause
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.clause"),
("name", "=", "active"),
]
)
clause_01.field_id = field_01.id
clause_01.onchange_copyvalue()
self.assertEqual(clause_01.copyvalue, "${object.active or ''}")
# TEST 02: Set related 'Field' for dynamic placeholder to
# test onchange method
def test_onchange_copyvalue2(self):
clause_01 = self.test_clause
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.clause"),
("name", "=", "agreement_id"),
]
)
sub_field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "active"),
]
)
clause_01.field_id = field_01.id
clause_01.onchange_copyvalue()
self.assertEqual(clause_01.sub_object_id.model, "agreement")
clause_01.sub_model_object_field_id = sub_field_01.id
clause_01.onchange_copyvalue()
self.assertEqual(clause_01.copyvalue, "${object.agreement_id.active or ''}")
# TEST 03: Test Dynamic Field
def test_compute_dynamic_content(self):
clause_01 = self.test_clause
clause_01.content = "${object.name}"
self.assertEqual(
clause_01.dynamic_content,
"<p>{" + str(clause_01.id) + ": '</p><p>TestClause</p>'}",
)

View File

@@ -0,0 +1,45 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreementLine(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_product1 = self.env["product.product"].create({"name": "TEST1"})
self.test_product2 = self.env["product.product"].create({"name": "TEST2"})
self.test_line = self.env["agreement.line"].create(
{
"product_id": self.test_product1.id,
"name": "Test",
"uom_id": 1,
"agreement_id": self.test_agreement.id,
}
)
# TEST 01: Set line product onchange method
def test_onchange_product_id(self):
line_01 = self.test_line
line_01.product_id = self.test_product2.id
line_01._onchange_product_id()
self.assertEqual(line_01.name, "TEST2")

View File

@@ -0,0 +1,81 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreementRectical(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_recital = self.env["agreement.recital"].create(
{
"name": "TestRecital",
"title": "Test",
"content": "Test",
"agreement_id": self.test_agreement.id,
}
)
# TEST 01: Set 'Field' for dynamic placeholder, test onchange method
def test_onchange_copyvalue(self):
recital_01 = self.test_recital
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.recital"),
("name", "=", "active"),
]
)
recital_01.field_id = field_01.id
recital_01.onchange_copyvalue()
self.assertEqual(recital_01.copyvalue, "${object.active or ''}")
# TEST 02: Set related 'Field' for dynamic placeholder to
# test onchange method
def test_onchange_copyvalue2(self):
recital_01 = self.test_recital
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.recital"),
("name", "=", "agreement_id"),
]
)
sub_field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "active"),
]
)
recital_01.field_id = field_01.id
recital_01.onchange_copyvalue()
self.assertEqual(recital_01.sub_object_id.model, "agreement")
recital_01.sub_model_object_field_id = sub_field_01.id
recital_01.onchange_copyvalue()
self.assertEqual(recital_01.copyvalue, "${object.agreement_id.active or ''}")
# TEST 03: Test Dynamic Field
def test_compute_dynamic_content(self):
recital_01 = self.test_recital
recital_01.content = "${object.name}"
self.assertEqual(
recital_01.dynamic_content,
"<p>{" + str(recital_01.id) + ": '</p><p>TestRecital</p>'}",
)

View File

@@ -0,0 +1,81 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from datetime import timedelta
from odoo import fields
from odoo.tests.common import TransactionCase
class TestAgreementSection(TransactionCase):
def setUp(self):
super().setUp()
self.test_customer = self.env["res.partner"].create({"name": "TestCustomer"})
self.agreement_type = self.env["agreement.type"].create(
{
"name": "Test Agreement Type",
"domain": "sale",
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement",
"description": "Test",
"special_terms": "Test",
"partner_id": self.test_customer.id,
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_section = self.env["agreement.section"].create(
{
"name": "TestSection",
"title": "Test",
"content": "Test",
"agreement_id": self.test_agreement.id,
}
)
# TEST 01: Set 'Field' for dynamic placeholder, test onchange method
def test_onchange_copyvalue(self):
section_01 = self.test_section
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.section"),
("name", "=", "active"),
]
)
section_01.field_id = field_01.id
section_01.onchange_copyvalue()
self.assertEqual(section_01.copyvalue, "${object.active or ''}")
# TEST 02: Set related 'Field' for dynamic placeholder to
# test onchange method
def test_onchange_copyvalue2(self):
section_01 = self.test_section
field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement.section"),
("name", "=", "agreement_id"),
]
)
sub_field_01 = self.env["ir.model.fields"].search(
[
("model", "=", "agreement"),
("name", "=", "active"),
]
)
section_01.field_id = field_01.id
section_01.onchange_copyvalue()
self.assertEqual(section_01.sub_object_id.model, "agreement")
section_01.sub_model_object_field_id = sub_field_01.id
section_01.onchange_copyvalue()
self.assertEqual(section_01.copyvalue, "${object.agreement_id.active or ''}")
# TEST 03: Test Dynamic Field
def test_compute_dynamic_content(self):
section_01 = self.test_section
section_01.content = "${object.name}"
self.assertEqual(
section_01.dynamic_content,
"<p>{" + str(section_01.id) + ": '</p><p>TestSection</p>'}",
)

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement List View-->
@@ -26,15 +25,36 @@
<field name="arch" type="xml">
<form string="Agreement">
<header>
<button string="New Version" type="object" name="create_new_version" class="oe_highlight" attrs="{'invisible': [('state', '=', 'active')]}"/>
<button string="New Agreement" type="object" name="create_new_agreement" class="oe_highlight" attrs="{'invisible': [('is_template', '=', False)]}"/>
<field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}" domain="[('stage_type', '=', 'agreement')]"/>
<button
string="New Version"
type="object"
name="create_new_version"
class="oe_highlight"
attrs="{'invisible': [('state', '=', 'active')]}"
/>
<button
string="New Agreement"
type="object"
name="create_new_agreement"
class="oe_highlight"
attrs="{'invisible': [('is_template', '=', False)]}"
/>
<field
name="stage_id"
widget="statusbar"
clickable="True"
options="{'fold_field': 'fold'}"
domain="[('stage_type', '=', 'agreement')]"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
</div>
<div class="oe_button_box" name="button_box" />
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Agreement Name"/>
<label
for="name"
class="oe_edit_only"
string="Agreement Name"
/>
<h1>
<field name="name" />
</h1>
@@ -42,41 +62,51 @@
<group string="General">
<group>
<field name="code" readonly="1" />
<field name="parent_agreement_id"
domain="[('partner_id', '=', partner_id)]"/>
<field
name="parent_agreement_id"
domain="[('partner_id', '=', partner_id)]"
/>
<field name="is_template" />
</group>
<group>
<field name="agreement_type_id"
<field
name="agreement_type_id"
widget="selection"
required="True"/>
<field name="agreement_subtype_id"
required="True"
/>
<field
name="agreement_subtype_id"
widget="selection"
domain="[('agreement_type_id', '=', agreement_type_id)]"/>
<field name="assigned_user_id"
attrs="{'invisible': [('is_template', '=', True)], 'readonly':[('is_template', '=', True)]}"/>
domain="[('agreement_type_id', '=', agreement_type_id)]"
/>
<field
name="assigned_user_id"
attrs="{'invisible': [('is_template', '=', True)], 'readonly':[('is_template', '=', True)]}"
/>
<field name="active" invisible="1" />
<field name="state" invisible="1" />
</group>
</group>
<group string="Description">
<field name="description"
required="True"
nolabel="1"/>
<field name="description" required="True" nolabel="1" />
</group>
<group class="oe_edit_only">
<group>
<field name="field_id"
<field
name="field_id"
domain="[('model_id', '=', active_model),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"/>
('ttype', '!=', 'many2many')]"
/>
<field name="sub_object_id" readonly="1" />
<field name="sub_model_object_field_id"
<field
name="sub_model_object_field_id"
domain="[('model_id', '=', sub_object_id),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"
attrs="{'readonly':[('sub_object_id', '=', False)],
'required':[('sub_object_id', '!=', False)]}"/>
'required':[('sub_object_id', '!=', False)]}"
/>
<field name="default_value" />
<field name="copyvalue" />
</group>
@@ -86,105 +116,177 @@
<li>Select the agreement field</li>
<li>Select the sub-field</li>
<li>Enter the default value if the field is empty</li>
<li>Copy and paste the placeholder expression in the description or the special terms</li>
<li
>Copy and paste the placeholder expression in the description or the special terms</li>
</ol>
</p>
</group>
<group name="parties" string="Parties">
<group name="cust_parties">
<field name="use_parties_content" string="Use custom content" />
<field
name="use_parties_content"
string="Use custom content"
/>
</group>
<group name="cust_parties">
<p>
This section (on the left) allows you to replace the default listing of the parties with custom dynamic content.
</p>
</group>
<group name="partner"
string="Partner">
<group name="partner" string="Partner">
<div class="o_address_format">
<field name="partner_id"
domain="['|',('customer', '=', True),('supplier', '=', True)]"
<field
name="partner_id"
context="{'show_address': 1}"
options="{&quot;always_reload&quot;: True}"/>
options="{&quot;always_reload&quot;: True}"
/>
</div>
</group>
<group name="company"
string="Company">
<group name="company" string="Company">
<div class="o_address_format">
<field name="company_id"
<field
name="company_id"
readonly="1"
context="{'show_address': 1}"
options="{&quot;always_reload&quot;: True}"/>
options="{&quot;always_reload&quot;: True}"
/>
</div>
<field name="company_partner_id" invisible="1" />
</group>
<group name="partner_left" string="Primary Contact">
<field name="partner_contact_id" domain="[('parent_id', '=', partner_id)]" nolabel="1"/>
<field name="partner_contact_phone" widget="phone" readonly="1" nolabel="1"/>
<field name="partner_contact_email" widget="email" readonly="1" nolabel="1"/>
<field
name="partner_contact_id"
domain="[('parent_id', '=', partner_id)]"
nolabel="1"
/>
<field
name="partner_contact_phone"
widget="phone"
readonly="1"
nolabel="1"
/>
<field
name="partner_contact_email"
widget="email"
readonly="1"
nolabel="1"
/>
</group>
<group name="contact_right" string="Primary Contact">
<field name="company_contact_id" domain="[('parent_id', '=', company_partner_id)]" nolabel="1"/>
<field name="company_contact_phone" widget="phone" readonly="1" nolabel="1"/>
<field name="company_contact_email" widget="email" readonly="1" nolabel="1"/>
<field
name="company_contact_id"
domain="[('parent_id', '=', company_partner_id)]"
nolabel="1"
/>
<field
name="company_contact_phone"
widget="phone"
readonly="1"
nolabel="1"
/>
<field
name="company_contact_email"
widget="email"
readonly="1"
nolabel="1"
/>
</group>
</group>
<group name="parties_content" string="Parties Content" attrs="{'invisible':[('use_parties_content', '=', False)]}">
<group
name="parties_content"
string="Parties Content"
attrs="{'invisible':[('use_parties_content', '=', False)]}"
>
<field name="parties" nolabel="1" />
</group>
<group name="term_information">
<group name="termdates_left" string="Term Dates">
<field name="start_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/>
<field name="end_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/>
<field
name="start_date"
attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"
/>
<field
name="end_date"
attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"
/>
<field name="expiration_notice" />
<field name="change_notice" />
<field name="notification_address_id" domain="['|', ('parent_id', '=', partner_id), ('parent_id', '=', company_partner_id)]"/>
<field
name="notification_address_id"
domain="['|', ('parent_id', '=', partner_id), ('parent_id', '=', company_partner_id)]"
/>
<field name="termination_requested" />
<field name="termination_date" />
</group>
</group>
<group string="Special Terms">
<field name="special_terms"
nolabel="1"/>
<field name="special_terms" nolabel="1" />
</group>
<notebook>
<page name="structure" string="Structure">
<div>
<button name="%(partner_agreement_contract_document_preview)d" string="Preview" type="action" class="oe_highlight"/>
<button name="%(partner_agreement_contract_document)d" string="Print" type="action" class="oe_highlight"/>
<button
name="%(partner_agreement_contract_document_preview)d"
string="Preview"
type="action"
class="oe_highlight"
/>
<button
name="%(partner_agreement_contract_document)d"
string="Print"
type="action"
class="oe_highlight"
/>
</div>
<separator string="Recitals" />
<field name="recital_ids"
<field
name="recital_ids"
default_order="sequence"
nolabel="1"
context="{'default_agreement': active_id}"/>
context="{'default_agreement': active_id}"
/>
<separator string="Sections" />
<field name="sections_ids"
<field
name="sections_ids"
default_order='sequence'
nolabel="1"
context="{'default_agreement': active_id}"/>
context="{'default_agreement': active_id}"
/>
<separator string="Clauses" />
<field name="clauses_ids"
<field
name="clauses_ids"
default_order='clause_id, sequence'
nolabel="1"
context="{'default_agreement': active_id}"/>
context="{'default_agreement': active_id}"
/>
<separator string="Appendices" />
<field name="appendix_ids"
<field
name="appendix_ids"
default_order='sequence'
nolabel="1"
context="{'default_agreement': active_id}"/>
context="{'default_agreement': active_id}"
/>
</page>
<page name="signature" string="Signatures">
<group>
<group string="Partner">
<field name="partner_signed_date" />
<field name="partner_signed_user_id" domain="[('parent_id', '=', partner_id)]"/>
<field
name="partner_signed_user_id"
domain="[('parent_id', '=', partner_id)]"
/>
</group>
<group string="Company">
<field name="company_signed_date" />
<field name="company_signed_user_id" />
<field name="signed_contract" filename="signed_contract_filename"/>
<field name="signed_contract_filename" invisible="1"/>
<field
name="signed_contract"
filename="signed_contract_filename"
/>
<field
name="signed_contract_filename"
invisible="1"
/>
</group>
</group>
</page>
@@ -208,7 +310,10 @@
</field>
</page>
<page name="old_versions" string="Revisions">
<field name="previous_version_agreements_ids" string="Previouse Versions">
<field
name="previous_version_agreements_ids"
string="Previouse Versions"
>
<tree default_order='version desc'>
<field name="name" />
<field name="version" />
@@ -217,18 +322,34 @@
</field>
</page>
<page name="performance" string="Performance">
<p>This section is a place where financial records will show the current performance of this agreement.</p>
<p
>This section is a place where financial records will show the current performance of this agreement.</p>
<p>Perhaps include invoices with total vs costs? </p>
</page>
</notebook>
<group string="Administration">
<div>
<p>Reviewed by <field name="reviewed_user_id" class="oe_inline"/> on <field name="reviewed_date" class="oe_inline"/>.</p>
<p>Approved by <field name="approved_user_id" class="oe_inline"/> on <field name="approved_date" class="oe_inline"/>.</p>
<p>Reviewed by <field
name="reviewed_user_id"
class="oe_inline"
/> on <field
name="reviewed_date"
class="oe_inline"
/>.</p>
<p>Approved by <field
name="approved_user_id"
class="oe_inline"
/> on <field
name="approved_date"
class="oe_inline"
/>.</p>
</div>
</group>
<footer>
Version: <field name="version" readonly="True"/>.<field name="revision" readonly="True"/>
Version: <field name="version" readonly="True" />.<field
name="revision"
readonly="True"
/>
| Created By: <field name="create_uid" readonly="True" />
| Created On: <field name="create_date" readonly="True" />
</footer>
@@ -252,44 +373,83 @@
<field name="assigned_user_id" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
<div
t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"
>
<div class="oe_kanban_content">
<div class="o_kanban_record_top">
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title">
<field name="name" />
</strong><br />
<div class="o_kanban_record_subtitle text-muted">
<field name="partner_id" invisible="context.get('default_partner_id', False)"/>
<t t-if="record.end_date.raw_value and record.end_date.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t>
<div
class="o_kanban_record_subtitle text-muted"
>
<field name="partner_id" />
<t
t-if="record.end_date.raw_value and record.end_date.raw_value lt (new Date())"
t-set="red"
>oe_kanban_text_red</t>
<div t-attf-class="#{red || ''}">
<i><field name="end_date" /></i>
</div>
</div>
</div>
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
<a role="button" class="dropdown-toggle btn" data-toggle="dropdown" href="#">
<span class="fa fa-ellipsis-v" aria-hidden="true"/>
<div
class="o_dropdown_kanban dropdown"
groups="base.group_user"
>
<a
role="button"
class="dropdown-toggle btn"
data-toggle="dropdown"
href="#"
>
<span
class="fa fa-ellipsis-v"
aria-hidden="true"
title="Icon"
/>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li t-if="widget.editable"><a type="edit">Edit</a></li>
<ul
class="dropdown-menu"
role="menu"
aria-labelledby="dLabel"
>
<li t-if="widget.editable"><a
type="edit"
>Edit</a></li>
<li class="divider" />
<li class="dropdown-header">Record's Colour</li>
<li
class="dropdown-header"
>Record's Colour</li>
<li>
<ul class="oe_kanban_colorpicker" data-field="color"/>
<ul
class="oe_kanban_colorpicker"
data-field="color"
/>
</li>
</ul>
</div>
</div>
<div class="o_kanban_record_body">
<field name="agreement_type_id"/> - <field name="agreement_subtype_id"/>
<field name="agreement_type_id" /> - <field
name="agreement_subtype_id"
/>
</div>
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left">
V: <field name="version" />
</div>
<div class="oe_kanban_bottom_right">
<img t-att-src="kanban_image('res.users', 'image_small', record.assigned_user_id.raw_value)" t-att-title="record.assigned_user_id.value" width="36" height="36" class="oe_kanban_avatar" alt="user &amp; picture"/>
<img
t-att-src="kanban_image('res.users', 'image_small', record.assigned_user_id.raw_value)"
t-att-title="record.assigned_user_id.value"
width="36"
height="36"
class="oe_kanban_avatar"
alt="user &amp; picture"
/>
</div>
</div>
</div>
@@ -311,11 +471,33 @@
<field name="partner_id" />
<field name="agreement_type_id" />
<field name="agreement_subtype_id" />
<filter name="filter_non_template" string="Non-Templates" domain="[('active','=',True),('is_template', '=', False)]"/>
<filter name="filter_inactive" string="Archived" domain="[('active','=',False)]"/>
<filter name="filter_templates" string="Templates" domain="[('active','=',True),('is_template', '=', True)]"/>
<filter name="group_partner_id" string="Partners" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<filter name="group_status" string="Status" icon="terp-partner" context="{'group_by':'state'}"/>
<filter
name="filter_non_template"
string="Non-Templates"
domain="[('active','=',True),('is_template', '=', False)]"
/>
<filter
name="filter_inactive"
string="Archived"
domain="[('active','=',False)]"
/>
<filter
name="filter_templates"
string="Templates"
domain="[('active','=',True),('is_template', '=', True)]"
/>
<filter
name="group_partner_id"
string="Partners"
icon="terp-partner"
context="{'group_by':'partner_id'}"
/>
<filter
name="group_status"
string="Status"
icon="terp-partner"
context="{'group_by':'state'}"
/>
</search>
</field>
</record>
@@ -344,7 +526,6 @@
<record id="action_agreement_report_order" model="ir.actions.act_window">
<field name="name">Agreements</field>
<field name="res_model">agreement</field>
<field name="view_type">form</field>
<field name="view_mode">graph,pivot</field>
</record>

View File

@@ -1,5 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Appendix List View-->
@@ -24,11 +22,14 @@
<field name="arch" type="xml">
<form string="Appendix">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</div>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" /></h1>
@@ -45,17 +46,21 @@
<field name="content" widget="html" />
<group class="oe_edit_only">
<group>
<field name="field_id"
<field
name="field_id"
domain="[('model_id', '=', active_model),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"/>
('ttype', '!=', 'many2many')]"
/>
<field name="sub_object_id" readonly="1" />
<field name="sub_model_object_field_id"
<field
name="sub_model_object_field_id"
domain="[('model_id', '=', sub_object_id),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"
attrs="{'readonly':[('sub_object_id', '=', False)],
'required':[('sub_object_id', '!=', False)]}"/>
'required':[('sub_object_id', '!=', False)]}"
/>
<field name="default_value" />
<field name="copyvalue" />
</group>
@@ -65,7 +70,8 @@
<li>Select the appendix field</li>
<li>Select the sub-field</li>
<li>Enter the default value if the field is empty</li>
<li>Copy and paste the placeholder expression in the content</li>
<li
>Copy and paste the placeholder expression in the content</li>
</ol>
</p>
</group>
@@ -79,8 +85,13 @@
<field name="name">Agreement Appendix Search</field>
<field name="model">agreement.appendix</field>
<field name="arch" type="xml">
<search>
<filter name="group_agreement" icon="terp-partner" context="{'group_by':'agreement_id'}"/>
<search string="Appendix">
<field name="name" />
<filter
name="group_agreement"
icon="terp-partner"
context="{'group_by':'agreement_id'}"
/>
</search>
</field>
</record>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Clause List View-->
@@ -24,11 +23,14 @@
<field name="arch" type="xml">
<form string="Clause">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</div>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" /></h1>
@@ -37,7 +39,10 @@
<group>
<field name="title" />
<field name="agreement_id" />
<field name="section_id" domain="[('agreement_id', '=', agreement_id)]"/>
<field
name="section_id"
domain="[('agreement_id', '=', agreement_id)]"
/>
</group>
<group>
<field name="sequence" />
@@ -46,17 +51,21 @@
<field name="content" widget="html" />
<group class="oe_edit_only">
<group>
<field name="field_id"
<field
name="field_id"
domain="[('model_id', '=', active_model),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"/>
('ttype', '!=', 'many2many')]"
/>
<field name="sub_object_id" readonly="1" />
<field name="sub_model_object_field_id"
<field
name="sub_model_object_field_id"
domain="[('model_id', '=', sub_object_id),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"
attrs="{'readonly':[('sub_object_id', '=', False)],
'required':[('sub_object_id', '!=', False)]}"/>
'required':[('sub_object_id', '!=', False)]}"
/>
<field name="default_value" />
<field name="copyvalue" />
</group>
@@ -66,7 +75,8 @@
<li>Select the clause field</li>
<li>Select the sub-field</li>
<li>Enter the default value if the field is empty</li>
<li>Copy and paste the placeholder expression in the content</li>
<li
>Copy and paste the placeholder expression in the content</li>
</ol>
</p>
</group>
@@ -80,9 +90,18 @@
<field name="name">Agreement Clause Search</field>
<field name="model">agreement.clause</field>
<field name="arch" type="xml">
<search string="Agreement Clause Search">
<filter name="group_agreement" icon="terp-partner" context="{'group_by':'agreement_id'}"/>
<filter name="group_section" icon="terp-partner" context="{'group_by':'section_id'}"/>
<search string="Clause">
<field name="name" />
<filter
name="group_agreement"
icon="terp-partner"
context="{'group_by':'agreement_id'}"
/>
<filter
name="group_section"
icon="terp-partner"
context="{'group_by':'section_id'}"
/>
</search>
</field>
</record>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Increase Type List View-->

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Recital List View-->
@@ -23,11 +22,14 @@
<field name="arch" type="xml">
<form string="Recital">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</div>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" /></h1>
@@ -44,17 +46,21 @@
<field name="content" widget="html" />
<group class="oe_edit_only">
<group>
<field name="field_id"
<field
name="field_id"
domain="[('model_id', '=', active_model),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"/>
('ttype', '!=', 'many2many')]"
/>
<field name="sub_object_id" readonly="1" />
<field name="sub_model_object_field_id"
<field
name="sub_model_object_field_id"
domain="[('model_id', '=', sub_object_id),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"
attrs="{'readonly':[('sub_object_id', '=', False)],
'required':[('sub_object_id', '!=', False)]}"/>
'required':[('sub_object_id', '!=', False)]}"
/>
<field name="default_value" />
<field name="copyvalue" />
</group>
@@ -64,7 +70,8 @@
<li>Select the recital field</li>
<li>Select the sub-field</li>
<li>Enter the default value if the field is empty</li>
<li>Copy and paste the placeholder expression in the content</li>
<li
>Copy and paste the placeholder expression in the content</li>
</ol>
</p>
</group>
@@ -78,8 +85,13 @@
<field name="name">Agreement Recital Search</field>
<field name="model">agreement.recital</field>
<field name="arch" type="xml">
<search>
<filter name="group_agreement" icon="terp-partner" context="{'group_by':'agreement_id'}"/>
<search string="Recitals">
<field name="name" />
<filter
name="group_agreement"
icon="terp-partner"
context="{'group_by':'agreement_id'}"
/>
</search>
</field>
</record>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Renewal Type List View-->

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Sections List View-->
@@ -23,11 +22,14 @@
<field name="arch" type="xml">
<form string="Section">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button" options="{&quot;terminology&quot;: &quot;archive&quot;}"/>
</button>
</div>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1><field name="name" /></h1>
@@ -46,17 +48,21 @@
<field name='content' nolabel="1" />
<group class="oe_edit_only">
<group>
<field name="field_id"
<field
name="field_id"
domain="[('model_id', '=', active_model),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"/>
('ttype', '!=', 'many2many')]"
/>
<field name="sub_object_id" readonly="1" />
<field name="sub_model_object_field_id"
<field
name="sub_model_object_field_id"
domain="[('model_id', '=', sub_object_id),
('ttype', '!=', 'one2many'),
('ttype', '!=', 'many2many')]"
attrs="{'readonly':[('sub_object_id', '=', False)],
'required':[('sub_object_id', '!=', False)]}"/>
'required':[('sub_object_id', '!=', False)]}"
/>
<field name="default_value" />
<field name="copyvalue" />
</group>
@@ -65,16 +71,20 @@
<ol>
<li>Select the section field</li>
<li>Select the sub-field</li>
<li>Enter the default value if the field is empty</li>
<li>Copy and paste the placeholder expression in the content</li>
<li
>Enter the default value if the field is empty</li>
<li
>Copy and paste the placeholder expression in the content</li>
</ol>
</p>
</group>
</page>
<page string="Clauses">
<field name="clauses_ids"
<field
name="clauses_ids"
nolabel="1"
context="{'default_section_id': active_id, 'default_agreement_id': agreement_id}">
context="{'default_section_id': active_id, 'default_agreement_id': agreement_id}"
>
<tree>
<field name="sequence" widget="handle" />
<field name="name" />
@@ -93,8 +103,14 @@
<field name="name">Agreement Section Search</field>
<field name="model">agreement.section</field>
<field name="arch" type="xml">
<search string="Agreement Section Search">
<filter name="group_agreement" string="Agreements" icon="terp-partner" context="{'group_by':'agreement_id'}"/>
<search string="Section">
<field name="name" />
<filter
name="group_agreement"
string="Agreements"
icon="terp-partner"
context="{'group_by':'agreement_id'}"
/>
</search>
</field>
</record>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Stage List View-->

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Sub Type List View-->
@@ -28,7 +27,7 @@
<group>
<field name="agreement_type_id" />
</group>
<group></group>
<group />
</group>
</sheet>
</form>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Agreement Type List View-->
@@ -20,8 +19,7 @@
<field name="inherit_id" ref="agreement.agreement_type_form_view" />
<field name="arch" type="xml">
<xpath expr="//sheet" position="inside">
<field name="agreement_subtypes_ids"
nolabel="1">
<field name="agreement_subtypes_ids" nolabel="1">
<tree editable="bottom">
<field name="name" />
</tree>

View File

@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Remove top menu from agreement module -->
<!-- <delete model="ir.ui.menu" id="agreement.agreement_menu" /> -->
@@ -11,74 +9,86 @@
web_icon="agreement_legal,static/description/icon.png"
sequence="80"
action="agreement_dashboard_agreement"
groups="agreement_legal.group_agreement_readonly"/>
groups="agreement_legal.group_agreement_readonly"
/>
<!-- Dashboard -->
<menuitem
name="Dashboard"
id="agreement_dashboard"
parent="agreement.agreement_menu"
sequence="10"/>
sequence="10"
/>
<menuitem
name="Agreements"
id="dashboard_agreements"
parent="agreement_dashboard"
sequence="10"
action="agreement_dashboard_agreement"/>
action="agreement_dashboard_agreement"
/>
<!-- Operations -->
<menuitem
name="Operations"
id="agreement_operations"
parent="agreement.agreement_menu"
sequence="20"/>
sequence="20"
/>
<menuitem
name="Agreements"
id="operations_agreements"
parent="agreement_operations"
sequence="10"
action="agreement_operations_agreement"/>
action="agreement_operations_agreement"
/>
<!-- Master Data -->
<menuitem
name="Master Data"
id="agreement_masterdata"
parent="agreement.agreement_menu"
sequence="30"/>
sequence="30"
/>
<menuitem
name="Contents"
id="agreement_data_contents"
parent="agreement_masterdata"
sequence="10"/>
sequence="10"
/>
<menuitem
name="Recitals"
id="agreement_recitals"
parent="agreement_data_contents"
sequence="10"
action="agreement_recital_action"/>
action="agreement_recital_action"
/>
<menuitem
name="Clauses"
id="agreement_clauses"
parent="agreement_data_contents"
sequence="20"
action="partner_agreement_action_clause"/>
action="partner_agreement_action_clause"
/>
<menuitem
name="Sections"
id="agreement_sections"
parent="agreement_data_contents"
sequence="30"
action="partner_agreement_action_section"/>
action="partner_agreement_action_section"
/>
<menuitem
name="Appendices"
id="agreement_appendices"
parent="agreement_data_contents"
sequence="40"
action="agreement_appendix_action"/>
action="agreement_appendix_action"
/>
<menuitem
name="Products"
id="agreement_products"
sequence="100"
parent="agreement_masterdata"
action="product.product_template_action"/>
action="product.product_template_action"
/>
<!-- Reporting -->
<menuitem
@@ -86,14 +96,16 @@
id="agreement_reporting"
sequence="40"
parent="agreement.agreement_menu"
groups="agreement_legal.group_agreement_manager"/>
groups="agreement_legal.group_agreement_manager"
/>
<menuitem
name="Agreements"
id="agreement_agreement_reporting"
sequence="10"
parent="agreement_reporting"
action="action_agreement_report_order"/>
action="action_agreement_report_order"
/>
<!-- Configuration -->
<menuitem
@@ -101,47 +113,55 @@
id="agreement_configuration"
sequence="50"
parent="agreement.agreement_menu"
groups="agreement_legal.group_agreement_manager"/>
groups="agreement_legal.group_agreement_manager"
/>
<menuitem
name="Settings"
id="agreement_settings"
sequence="10"
parent="agreement_configuration"
action="agreement_legal.action_agreement_config"/>
action="agreement_legal.action_agreement_config"
/>
<menuitem
name="Templates"
id="template"
parent="agreement_configuration"
sequence="20"
action="partner_agreement_agreement_templates"/>
action="partner_agreement_agreement_templates"
/>
<menuitem
name="Renewal Types"
id="agreement_renewaltype"
parent="agreement_configuration"
sequence="30"
action="partner_agreement_action_renewaltype"/>
action="partner_agreement_action_renewaltype"
/>
<menuitem
name="Increase Types"
id="agreement_increamenttypes"
parent="agreement_configuration"
sequence="31"
action="partner_agreement_action_increasetype"/>
action="partner_agreement_action_increasetype"
/>
<menuitem
name="Stages"
id="agreement_stages"
parent="agreement_configuration"
sequence="40"
action="partner_agreement_action_stage"/>
action="partner_agreement_action_stage"
/>
<menuitem
name="Types"
id="agreement_types"
parent="agreement_configuration"
sequence="50"
action="partner_agreement_action_type"/>
action="partner_agreement_action_type"
/>
<menuitem
name="Sub-Types"
id="agreement_subtypes"
parent="agreement_configuration"
sequence="60"
action="partner_agreement_action_subtype"/>
action="partner_agreement_action_subtype"
/>
</odoo>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
@@ -8,11 +7,13 @@
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block"
<div
class="app_settings_block"
data-string="Agreements"
string="Agreements"
data-key="agreement_legal"
groups="agreement_legal.group_agreement_manager">
groups="agreement_legal.group_agreement_manager"
>
<h2>Operations</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
@@ -25,8 +26,17 @@
Sell and purchase products in different units of measure
</div>
<div class="content-group">
<div class="mt16" attrs="{'invisible': [('group_uom', '=', False)]}">
<button name="%(uom.product_uom_form_action)d" icon="fa-arrow-right" type="action" string="Units Of Measure" class="btn-link"/>
<div
class="mt16"
attrs="{'invisible': [('group_uom', '=', False)]}"
>
<button
name="%(uom.product_uom_form_action)d"
icon="fa-arrow-right"
type="action"
string="Units Of Measure"
class="btn-link"
/>
</div>
</div>
</div>
@@ -39,19 +49,24 @@
<field name="module_agreement_sale" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Sales"/>
<label for="module_agreement_sale" string="Sales" />
<div class="text-muted">
Create an agreement when the sales order is confirmed
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box"
attrs="{'invisible': [('module_agreement_sale', '!=', True)]}">
<div
class="col-xs-12 col-md-6 o_setting_box"
attrs="{'invisible': [('module_agreement_sale', '!=', True)]}"
>
<div class="o_setting_left_pane">
<field name="module_agreement_sale_subscription" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Sale Subscriptions"/>
<label
for="module_agreement_sale_subscription"
string="Sale Subscriptions"
/>
<div class="text-muted">
Link your subscriptions to an agreement
</div>
@@ -62,7 +77,10 @@
<field name="module_fieldservice_agreement" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Field Service"/>
<label
for="module_fieldservice_agreement"
string="Field Service"
/>
<div class="text-muted">
Link your Field Service orders and equipments to an agreement
</div>
@@ -73,7 +91,10 @@
<field name="module_agreement_stock" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Inventory"/>
<label
for="module_agreement_stock"
string="Inventory"
/>
<div class="text-muted">
Link your transfers to an agreement
</div>
@@ -84,7 +105,7 @@
<field name="module_agreement_rma" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Returns"/>
<label for="module_agreement_rma" string="Returns" />
<div class="text-muted">
Link your returns to an agreement
</div>
@@ -95,7 +116,10 @@
<field name="module_agreement_maintenance" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Maintenance"/>
<label
for="module_agreement_maintenance"
string="Maintenance"
/>
<div class="text-muted">
Manage maintenance agreements and contracts
</div>
@@ -106,7 +130,10 @@
<field name="module_agreement_mrp" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Manufacturing"/>
<label
for="module_agreement_mrp"
string="Manufacturing"
/>
<div class="text-muted">
Link your manufacturing orders to an agreement
</div>
@@ -117,7 +144,7 @@
<field name="module_agreement_repair" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Repair"/>
<label for="module_agreement_repair" string="Repair" />
<div class="text-muted">
Link your repair orders to an agreement
</div>
@@ -128,7 +155,10 @@
<field name="module_agreement_project" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Project"/>
<label
for="module_agreement_project"
string="Project"
/>
<div class="text-muted">
Link your projects and tasks to an agreement
</div>
@@ -139,7 +169,10 @@
<field name="module_agreement_helpdesk" />
</div>
<div class="o_setting_right_pane">
<label for="" string="Helpdesk"/>
<label
for="module_agreement_helpdesk"
string="Helpdesk"
/>
<div class="text-muted">
Link your Helpdesk tickets to an agreement
</div>
@@ -151,11 +184,12 @@
</field>
</record>
<act_window id="action_agreement_config"
name="Settings"
res_model="res.config.settings"
view_mode="form"
target="inline"
context="{'module': 'agreement'}"/>
<record id="action_agreement_config" model="ir.actions.act_window">
<field name="name">Settings</field>
<field name="res_model">res.config.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
<field name="context">{'module': 'agreement'}</field>
</record>
</odoo>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="partner_form">
@@ -14,4 +13,5 @@
</xpath>
</field>
</record>
</odoo>