mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] agreement_legal: Migration to 13.0
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
"website": "https://github.com/OCA/contract",
|
"website": "https://github.com/OCA/contract",
|
||||||
"category": "Partner",
|
"category": "Partner",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"version": "12.0.2.0.1",
|
"version": "13.0.1.0.0",
|
||||||
"depends": ["contacts", "agreement", "product"],
|
"depends": ["contacts", "agreement", "product"],
|
||||||
"data": [
|
"data": [
|
||||||
"data/ir_sequence.xml",
|
"data/ir_sequence.xml",
|
||||||
|
|||||||
@@ -1,12 +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;"
|
|
||||||
)
|
|
||||||
@@ -23,9 +23,7 @@ class Agreement(models.Model):
|
|||||||
help="The revision will increase with every save event.",
|
help="The revision will increase with every save event.",
|
||||||
)
|
)
|
||||||
description = fields.Text(
|
description = fields.Text(
|
||||||
string="Description",
|
string="Description", tracking=True, help="Description of the agreement",
|
||||||
track_visibility="onchange",
|
|
||||||
help="Description of the agreement",
|
|
||||||
)
|
)
|
||||||
dynamic_description = fields.Text(
|
dynamic_description = fields.Text(
|
||||||
compute="_compute_dynamic_description",
|
compute="_compute_dynamic_description",
|
||||||
@@ -33,12 +31,10 @@ class Agreement(models.Model):
|
|||||||
help="Compute dynamic description",
|
help="Compute dynamic description",
|
||||||
)
|
)
|
||||||
start_date = fields.Date(
|
start_date = fields.Date(
|
||||||
string="Start Date",
|
string="Start Date", tracking=True, help="When the agreement starts.",
|
||||||
track_visibility="onchange",
|
|
||||||
help="When the agreement starts.",
|
|
||||||
)
|
)
|
||||||
end_date = fields.Date(
|
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")
|
color = fields.Integer(string="Color")
|
||||||
active = fields.Boolean(
|
active = fields.Boolean(
|
||||||
@@ -49,33 +45,33 @@ class Agreement(models.Model):
|
|||||||
)
|
)
|
||||||
company_signed_date = fields.Date(
|
company_signed_date = fields.Date(
|
||||||
string="Signed on",
|
string="Signed on",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Date the contract was signed by Company.",
|
help="Date the contract was signed by Company.",
|
||||||
)
|
)
|
||||||
partner_signed_date = fields.Date(
|
partner_signed_date = fields.Date(
|
||||||
string="Signed on (Partner)",
|
string="Signed on (Partner)",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Date the contract was signed by the Partner.",
|
help="Date the contract was signed by the Partner.",
|
||||||
)
|
)
|
||||||
term = fields.Integer(
|
term = fields.Integer(
|
||||||
string="Term (Months)",
|
string="Term (Months)",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Number of months this agreement/contract is in effect with the "
|
help="Number of months this agreement/contract is in effect with the "
|
||||||
"partner.",
|
"partner.",
|
||||||
)
|
)
|
||||||
expiration_notice = fields.Integer(
|
expiration_notice = fields.Integer(
|
||||||
string="Exp. Notice (Days)",
|
string="Exp. Notice (Days)",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Number of Days before expiration to be notified.",
|
help="Number of Days before expiration to be notified.",
|
||||||
)
|
)
|
||||||
change_notice = fields.Integer(
|
change_notice = fields.Integer(
|
||||||
string="Change Notice (Days)",
|
string="Change Notice (Days)",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Number of Days to be notified before changes.",
|
help="Number of Days to be notified before changes.",
|
||||||
)
|
)
|
||||||
special_terms = fields.Text(
|
special_terms = fields.Text(
|
||||||
string="Special Terms",
|
string="Special Terms",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Any terms that you have agreed to and want to track on the "
|
help="Any terms that you have agreed to and want to track on the "
|
||||||
"agreement/contract.",
|
"agreement/contract.",
|
||||||
)
|
)
|
||||||
@@ -88,44 +84,44 @@ class Agreement(models.Model):
|
|||||||
string="Reference",
|
string="Reference",
|
||||||
required=True,
|
required=True,
|
||||||
default=lambda self: _("New"),
|
default=lambda self: _("New"),
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
copy=False,
|
copy=False,
|
||||||
help="ID used for internal contract tracking.",
|
help="ID used for internal contract tracking.",
|
||||||
)
|
)
|
||||||
increase_type_id = fields.Many2one(
|
increase_type_id = fields.Many2one(
|
||||||
"agreement.increasetype",
|
comodel_name="agreement.increasetype",
|
||||||
string="Increase Type",
|
string="Increase Type",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="The amount that certain rates may increase.",
|
help="The amount that certain rates may increase.",
|
||||||
)
|
)
|
||||||
termination_requested = fields.Date(
|
termination_requested = fields.Date(
|
||||||
string="Termination Requested Date",
|
string="Termination Requested Date",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Date that a request for termination was received.",
|
help="Date that a request for termination was received.",
|
||||||
)
|
)
|
||||||
termination_date = fields.Date(
|
termination_date = fields.Date(
|
||||||
string="Termination Date",
|
string="Termination Date",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Date that the contract was terminated.",
|
help="Date that the contract was terminated.",
|
||||||
)
|
)
|
||||||
reviewed_date = fields.Date(string="Reviewed Date", track_visibility="onchange")
|
reviewed_date = fields.Date(string="Reviewed Date", tracking=True)
|
||||||
reviewed_user_id = fields.Many2one(
|
reviewed_user_id = fields.Many2one(
|
||||||
"res.users", string="Reviewed By", track_visibility="onchange"
|
comodel_name="res.users", string="Reviewed By", tracking=True
|
||||||
)
|
)
|
||||||
approved_date = fields.Date(string="Approved Date", track_visibility="onchange")
|
approved_date = fields.Date(string="Approved Date", tracking=True)
|
||||||
approved_user_id = fields.Many2one(
|
approved_user_id = fields.Many2one(
|
||||||
"res.users", string="Approved By", track_visibility="onchange"
|
comodel_name="res.users", string="Approved By", tracking=True
|
||||||
)
|
)
|
||||||
currency_id = fields.Many2one("res.currency", string="Currency")
|
currency_id = fields.Many2one(comodel_name="res.currency", string="Currency")
|
||||||
partner_id = fields.Many2one(
|
partner_id = fields.Many2one(
|
||||||
"res.partner",
|
comodel_name="res.partner",
|
||||||
string="Partner",
|
string="Partner",
|
||||||
required=False,
|
required=False,
|
||||||
copy=True,
|
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(
|
partner_contact_id = fields.Many2one(
|
||||||
"res.partner",
|
comodel_name="res.partner",
|
||||||
string="Partner Contact",
|
string="Partner Contact",
|
||||||
copy=True,
|
copy=True,
|
||||||
help="The primary partner contact (If Applicable).",
|
help="The primary partner contact (If Applicable).",
|
||||||
@@ -137,7 +133,7 @@ class Agreement(models.Model):
|
|||||||
related="partner_contact_id.email", string="Partner Email"
|
related="partner_contact_id.email", string="Partner Email"
|
||||||
)
|
)
|
||||||
company_contact_id = fields.Many2one(
|
company_contact_id = fields.Many2one(
|
||||||
"res.partner",
|
comodel_name="res.partner",
|
||||||
string="Company Contact",
|
string="Company Contact",
|
||||||
copy=True,
|
copy=True,
|
||||||
help="The primary contact in the company.",
|
help="The primary contact in the company.",
|
||||||
@@ -182,7 +178,7 @@ class Agreement(models.Model):
|
|||||||
|
|
||||||
parties = fields.Html(
|
parties = fields.Html(
|
||||||
string="Parties",
|
string="Parties",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
default=_get_default_parties,
|
default=_get_default_parties,
|
||||||
help="Parties of the agreement",
|
help="Parties of the agreement",
|
||||||
)
|
)
|
||||||
@@ -191,87 +187,103 @@ class Agreement(models.Model):
|
|||||||
string="Dynamic Parties",
|
string="Dynamic Parties",
|
||||||
help="Compute dynamic parties",
|
help="Compute dynamic parties",
|
||||||
)
|
)
|
||||||
agreement_type_id = fields.Many2one(track_visibility="onchange",)
|
agreement_type_id = fields.Many2one(tracking=True)
|
||||||
agreement_subtype_id = fields.Many2one(
|
agreement_subtype_id = fields.Many2one(
|
||||||
"agreement.subtype",
|
comodel_name="agreement.subtype",
|
||||||
string="Agreement Sub-type",
|
string="Agreement Sub-type",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Select the sub-type of this agreement. Sub-Types are related to "
|
help="Select the sub-type of this agreement. Sub-Types are related to "
|
||||||
"agreement types.",
|
"agreement types.",
|
||||||
)
|
)
|
||||||
product_ids = fields.Many2many("product.template", string="Products & Services")
|
product_ids = fields.Many2many(
|
||||||
|
comodel_name="product.template", string="Products & Services"
|
||||||
|
)
|
||||||
assigned_user_id = fields.Many2one(
|
assigned_user_id = fields.Many2one(
|
||||||
"res.users",
|
comodel_name="res.users",
|
||||||
string="Assigned To",
|
string="Assigned To",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Select the user who manages this agreement.",
|
help="Select the user who manages this agreement.",
|
||||||
)
|
)
|
||||||
company_signed_user_id = fields.Many2one(
|
company_signed_user_id = fields.Many2one(
|
||||||
"res.users",
|
comodel_name="res.users",
|
||||||
string="Signed By",
|
string="Signed By",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="The user at our company who authorized/signed the agreement or "
|
help="The user at our company who authorized/signed the agreement or "
|
||||||
"contract.",
|
"contract.",
|
||||||
)
|
)
|
||||||
partner_signed_user_id = fields.Many2one(
|
partner_signed_user_id = fields.Many2one(
|
||||||
"res.partner",
|
comodel_name="res.partner",
|
||||||
string="Signed By (Partner)",
|
string="Signed By (Partner)",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Contact on the account that signed the agreement/contract.",
|
help="Contact on the account that signed the agreement/contract.",
|
||||||
)
|
)
|
||||||
parent_agreement_id = fields.Many2one(
|
parent_agreement_id = fields.Many2one(
|
||||||
"agreement",
|
comodel_name="agreement",
|
||||||
string="Parent Agreement",
|
string="Parent Agreement",
|
||||||
help="Link this agreement to a parent agreement. For example if this "
|
help="Link this agreement to a parent agreement. For example if this "
|
||||||
"agreement is an amendment to another agreement. This list will "
|
"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(
|
renewal_type_id = fields.Many2one(
|
||||||
"agreement.renewaltype",
|
comodel_name="agreement.renewaltype",
|
||||||
string="Renewal Type",
|
string="Renewal Type",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
help="Describes what happens after the contract expires.",
|
help="Describes what happens after the contract expires.",
|
||||||
)
|
)
|
||||||
recital_ids = fields.One2many(
|
recital_ids = fields.One2many(
|
||||||
"agreement.recital", "agreement_id", string="Recitals", copy=True
|
comodel_name="agreement.recital",
|
||||||
|
inverse_name="agreement_id",
|
||||||
|
string="Recitals",
|
||||||
|
copy=True,
|
||||||
)
|
)
|
||||||
sections_ids = fields.One2many(
|
sections_ids = fields.One2many(
|
||||||
"agreement.section", "agreement_id", string="Sections", copy=True
|
comodel_name="agreement.section",
|
||||||
|
inverse_name="agreement_id",
|
||||||
|
string="Sections",
|
||||||
|
copy=True,
|
||||||
|
)
|
||||||
|
clauses_ids = fields.One2many(
|
||||||
|
comodel_name="agreement.clause", inverse_name="agreement_id", string="Clauses"
|
||||||
)
|
)
|
||||||
clauses_ids = fields.One2many("agreement.clause", "agreement_id", string="Clauses")
|
|
||||||
appendix_ids = fields.One2many(
|
appendix_ids = fields.One2many(
|
||||||
"agreement.appendix", "agreement_id", string="Appendices", copy=True
|
comodel_name="agreement.appendix",
|
||||||
|
inverse_name="agreement_id",
|
||||||
|
string="Appendices",
|
||||||
|
copy=True,
|
||||||
)
|
)
|
||||||
previous_version_agreements_ids = fields.One2many(
|
previous_version_agreements_ids = fields.One2many(
|
||||||
"agreement",
|
comodel_name="agreement",
|
||||||
"parent_agreement_id",
|
inverse_name="parent_agreement_id",
|
||||||
string="Previous Versions",
|
string="Previous Versions",
|
||||||
copy=False,
|
copy=False,
|
||||||
domain=[("active", "=", False)],
|
domain=[("active", "=", False)],
|
||||||
)
|
)
|
||||||
child_agreements_ids = fields.One2many(
|
child_agreements_ids = fields.One2many(
|
||||||
"agreement",
|
comodel_name="agreement",
|
||||||
"parent_agreement_id",
|
inverse_name="parent_agreement_id",
|
||||||
string="Child Agreements",
|
string="Child Agreements",
|
||||||
copy=False,
|
copy=False,
|
||||||
domain=[("active", "=", True)],
|
domain=[("active", "=", True)],
|
||||||
)
|
)
|
||||||
line_ids = fields.One2many(
|
line_ids = fields.One2many(
|
||||||
"agreement.line", "agreement_id", string="Products/Services", copy=False
|
comodel_name="agreement.line",
|
||||||
|
inverse_name="agreement_id",
|
||||||
|
string="Products/Services",
|
||||||
|
copy=False,
|
||||||
)
|
)
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
[("draft", "Draft"), ("active", "Active"), ("inactive", "Inactive")],
|
[("draft", "Draft"), ("active", "Active"), ("inactive", "Inactive")],
|
||||||
default="draft",
|
default="draft",
|
||||||
track_visibility="always",
|
tracking=True,
|
||||||
)
|
)
|
||||||
notification_address_id = fields.Many2one(
|
notification_address_id = fields.Many2one(
|
||||||
"res.partner",
|
comodel_name="res.partner",
|
||||||
string="Notification Address",
|
string="Notification Address",
|
||||||
help="The address to send notificaitons to, if different from "
|
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_filename = fields.Char(string="Filename")
|
||||||
signed_contract = fields.Binary(string="Signed Document", track_visibility="always")
|
signed_contract = fields.Binary(string="Signed Document", tracking=True)
|
||||||
|
|
||||||
# Dynamic field editor
|
# Dynamic field editor
|
||||||
field_domain = fields.Char(
|
field_domain = fields.Char(
|
||||||
@@ -299,7 +311,6 @@ class Agreement(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute the dynamic content for mako expression
|
# compute the dynamic content for mako expression
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_description(self):
|
def _compute_dynamic_description(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for agreement in self:
|
for agreement in self:
|
||||||
@@ -309,7 +320,6 @@ class Agreement(models.Model):
|
|||||||
)
|
)
|
||||||
agreement.dynamic_description = description
|
agreement.dynamic_description = description
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_parties(self):
|
def _compute_dynamic_parties(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for agreement in self:
|
for agreement in self:
|
||||||
@@ -319,7 +329,6 @@ class Agreement(models.Model):
|
|||||||
)
|
)
|
||||||
agreement.dynamic_parties = parties
|
agreement.dynamic_parties = parties
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_special_terms(self):
|
def _compute_dynamic_special_terms(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for agreement in self:
|
for agreement in self:
|
||||||
@@ -338,16 +347,15 @@ class Agreement(models.Model):
|
|||||||
return stage_ids
|
return stage_ids
|
||||||
|
|
||||||
stage_id = fields.Many2one(
|
stage_id = fields.Many2one(
|
||||||
"agreement.stage",
|
comodel_name="agreement.stage",
|
||||||
string="Stage",
|
string="Stage",
|
||||||
group_expand="_read_group_stage_ids",
|
group_expand="_read_group_stage_ids",
|
||||||
help="Select the current stage of the agreement.",
|
help="Select the current stage of the agreement.",
|
||||||
track_visibility="onchange",
|
tracking=True,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create New Version Button
|
# Create New Version Button
|
||||||
@api.multi
|
|
||||||
def create_new_version(self, vals):
|
def create_new_version(self, vals):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if not rec.state == "draft":
|
if not rec.state == "draft":
|
||||||
@@ -394,7 +402,6 @@ class Agreement(models.Model):
|
|||||||
return super(Agreement, self).create(vals)
|
return super(Agreement, self).create(vals)
|
||||||
|
|
||||||
# Increments the revision on each save action
|
# Increments the revision on each save action
|
||||||
@api.multi
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
res = True
|
res = True
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class AgreementAppendix(models.Model):
|
|||||||
string="Dynamic Content",
|
string="Dynamic Content",
|
||||||
help="compute dynamic Content",
|
help="compute dynamic Content",
|
||||||
)
|
)
|
||||||
agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade")
|
agreement_id = fields.Many2one(
|
||||||
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
||||||
|
)
|
||||||
active = fields.Boolean(
|
active = fields.Boolean(
|
||||||
string="Active",
|
string="Active",
|
||||||
default=True,
|
default=True,
|
||||||
@@ -56,7 +58,6 @@ class AgreementAppendix(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute the dynamic content for mako expression
|
# compute the dynamic content for mako expression
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_content(self):
|
def _compute_dynamic_content(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for appendix in self:
|
for appendix in self:
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ class AgreementClause(models.Model):
|
|||||||
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")
|
sequence = fields.Integer(string="Sequence")
|
||||||
agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade")
|
agreement_id = fields.Many2one(
|
||||||
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
||||||
|
)
|
||||||
section_id = fields.Many2one(
|
section_id = fields.Many2one(
|
||||||
"agreement.section", string="Section", ondelete="cascade"
|
comodel_name="agreement.section", string="Section", ondelete="cascade"
|
||||||
)
|
)
|
||||||
content = fields.Html(string="Clause Content")
|
content = fields.Html(string="Clause Content")
|
||||||
dynamic_content = fields.Html(
|
dynamic_content = fields.Html(
|
||||||
@@ -57,7 +59,6 @@ class AgreementClause(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute the dynamic content for mako expression
|
# compute the dynamic content for mako expression
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_content(self):
|
def _compute_dynamic_content(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for clause in self:
|
for clause in self:
|
||||||
|
|||||||
@@ -8,11 +8,15 @@ class AgreementLine(models.Model):
|
|||||||
_name = "agreement.line"
|
_name = "agreement.line"
|
||||||
_description = "Agreement Lines"
|
_description = "Agreement Lines"
|
||||||
|
|
||||||
product_id = fields.Many2one("product.product", string="Product")
|
product_id = fields.Many2one(comodel_name="product.product", string="Product")
|
||||||
name = fields.Char(string="Description", required=True)
|
name = fields.Char(string="Description", required=True)
|
||||||
agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade")
|
agreement_id = fields.Many2one(
|
||||||
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
||||||
|
)
|
||||||
qty = fields.Float(string="Quantity")
|
qty = fields.Float(string="Quantity")
|
||||||
uom_id = fields.Many2one("uom.uom", string="Unit of Measure", required=True)
|
uom_id = fields.Many2one(
|
||||||
|
comodel_name="uom.uom", string="Unit of Measure", required=True
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange("product_id")
|
@api.onchange("product_id")
|
||||||
def _onchange_product_id(self):
|
def _onchange_product_id(self):
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ class AgreementRecital(models.Model):
|
|||||||
string="Dynamic Content",
|
string="Dynamic Content",
|
||||||
help="compute dynamic Content",
|
help="compute dynamic Content",
|
||||||
)
|
)
|
||||||
agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade")
|
agreement_id = fields.Many2one(
|
||||||
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
||||||
|
)
|
||||||
active = fields.Boolean(
|
active = fields.Boolean(
|
||||||
string="Active",
|
string="Active",
|
||||||
default=True,
|
default=True,
|
||||||
@@ -54,7 +56,6 @@ class AgreementRecital(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute the dynamic content for mako expression
|
# compute the dynamic content for mako expression
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_content(self):
|
def _compute_dynamic_content(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for recital in self:
|
for recital in self:
|
||||||
|
|||||||
@@ -14,9 +14,14 @@ class AgreementSection(models.Model):
|
|||||||
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")
|
sequence = fields.Integer(string="Sequence")
|
||||||
agreement_id = fields.Many2one("agreement", string="Agreement", ondelete="cascade")
|
agreement_id = fields.Many2one(
|
||||||
|
comodel_name="agreement", string="Agreement", ondelete="cascade"
|
||||||
|
)
|
||||||
clauses_ids = fields.One2many(
|
clauses_ids = fields.One2many(
|
||||||
"agreement.clause", "section_id", string="Clauses", copy=True
|
comodel_name="agreement.clause",
|
||||||
|
inverse_name="section_id",
|
||||||
|
string="Clauses",
|
||||||
|
copy=True,
|
||||||
)
|
)
|
||||||
content = fields.Html(string="Section Content")
|
content = fields.Html(string="Section Content")
|
||||||
dynamic_content = fields.Html(
|
dynamic_content = fields.Html(
|
||||||
@@ -57,7 +62,6 @@ class AgreementSection(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# compute the dynamic content for mako expression
|
# compute the dynamic content for mako expression
|
||||||
@api.multi
|
|
||||||
def _compute_dynamic_content(self):
|
def _compute_dynamic_content(self):
|
||||||
MailTemplates = self.env["mail.template"]
|
MailTemplates = self.env["mail.template"]
|
||||||
for section in self:
|
for section in self:
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ class AgreementSubtype(models.Model):
|
|||||||
_description = "Agreement Subtypes"
|
_description = "Agreement Subtypes"
|
||||||
|
|
||||||
name = fields.Char(string="Name", required=True)
|
name = fields.Char(string="Name", required=True)
|
||||||
agreement_type_id = fields.Many2one("agreement.type", string="Agreement Type")
|
agreement_type_id = fields.Many2one(
|
||||||
|
comodel_name="agreement.type", string="Agreement Type"
|
||||||
|
)
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ class AgreementType(models.Model):
|
|||||||
_description = "Agreement Types"
|
_description = "Agreement Types"
|
||||||
|
|
||||||
agreement_subtypes_ids = fields.One2many(
|
agreement_subtypes_ids = fields.One2many(
|
||||||
"agreement.subtype", "agreement_type_id", string="Subtypes"
|
comodel_name="agreement.subtype",
|
||||||
|
inverse_name="agreement_type_id",
|
||||||
|
string="Subtypes",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ from odoo import fields, models
|
|||||||
class Product(models.Model):
|
class Product(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
|
||||||
agreements_ids = fields.Many2many("agreement", string="Agreements")
|
agreements_ids = fields.Many2many(comodel_name="agreement", string="Agreements")
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ from odoo import fields, models
|
|||||||
class Partner(models.Model):
|
class Partner(models.Model):
|
||||||
_inherit = "res.partner"
|
_inherit = "res.partner"
|
||||||
|
|
||||||
agreement_ids = fields.One2many("agreement", "partner_id", string="Agreements")
|
agreement_ids = fields.One2many(
|
||||||
|
comodel_name="agreement", inverse_name="partner_id", string="Agreements"
|
||||||
|
)
|
||||||
|
|||||||
@@ -4,3 +4,7 @@
|
|||||||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
||||||
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
|
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
|
||||||
* Yves Goldberg <yves@ygol.com>
|
* Yves Goldberg <yves@ygol.com>
|
||||||
|
|
||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Víctor Martínez
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
odoo.define("agreement_legal.domain_widget_ext", function(require) {
|
odoo.define("agreement_legal.domain_widget_ext", function(require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var basic_fields = require("web.basic_fields");
|
const basic_fields = require("web.basic_fields");
|
||||||
var DomainSelector = require("web.DomainSelector");
|
const DomainSelector = require("web.DomainSelector");
|
||||||
var session = require("web.session");
|
const session = require("web.session");
|
||||||
var core = require("web.core");
|
const core = require("web.core");
|
||||||
var qweb = core.qweb;
|
const qweb = core.qweb;
|
||||||
var _t = core._t;
|
|
||||||
|
|
||||||
basic_fields.FieldDomain.include({
|
basic_fields.FieldDomain.include({
|
||||||
/**
|
/**
|
||||||
@@ -27,6 +26,7 @@ odoo.define("agreement_legal.domain_widget_ext", function(require) {
|
|||||||
* @override _render from AbstractField
|
* @override _render from AbstractField
|
||||||
* @returns {Deferred}
|
* @returns {Deferred}
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
_render: function() {
|
_render: function() {
|
||||||
// If there is no model, only change the non-domain-selector content
|
// If there is no model, only change the non-domain-selector content
|
||||||
if (!this._domainModel) {
|
if (!this._domainModel) {
|
||||||
@@ -35,11 +35,11 @@ odoo.define("agreement_legal.domain_widget_ext", function(require) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert char value to array value
|
// Convert char value to array value
|
||||||
var value = this.value || "[]";
|
const value = this.value || "[]";
|
||||||
|
|
||||||
// Create the domain selector or change the value of the current
|
// Create the domain selector or change the value of the current
|
||||||
// one...
|
// one...
|
||||||
var def;
|
/* eslint-disable no-negated-condition */
|
||||||
if (!this.domainSelector) {
|
if (!this.domainSelector) {
|
||||||
this.domainSelector = new DomainSelector(
|
this.domainSelector = new DomainSelector(
|
||||||
this,
|
this,
|
||||||
@@ -52,11 +52,12 @@ odoo.define("agreement_legal.domain_widget_ext", function(require) {
|
|||||||
partialUse: this.partialUse || false,
|
partialUse: this.partialUse || false,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
def = this.domainSelector.prependTo(this.$el);
|
const def = this.domainSelector.prependTo(this.$el);
|
||||||
} else {
|
} else {
|
||||||
def = this.domainSelector.setDomain(value);
|
const def = this.domainSelector.setDomain(value);
|
||||||
}
|
}
|
||||||
// ... then replace the other content (matched records, etc)
|
// ... then replace the other content (matched records, etc)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
return def.then(this._replaceContent.bind(this));
|
return def.then(this._replaceContent.bind(this));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -530,7 +530,6 @@
|
|||||||
<record id="action_agreement_report_order" model="ir.actions.act_window">
|
<record id="action_agreement_report_order" model="ir.actions.act_window">
|
||||||
<field name="name">Agreements</field>
|
<field name="name">Agreements</field>
|
||||||
<field name="res_model">agreement</field>
|
<field name="res_model">agreement</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">graph,pivot</field>
|
<field name="view_mode">graph,pivot</field>
|
||||||
</record>
|
</record>
|
||||||
<!-- actions opening views on models -->
|
<!-- actions opening views on models -->
|
||||||
|
|||||||
Reference in New Issue
Block a user