Skip to content

Commit

Permalink
[FIX] flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
ygol authored and patrickrwilson committed May 4, 2021
1 parent a0b2722 commit 731d9af
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 22 deletions.
82 changes: 61 additions & 21 deletions agreement_legal/models/agreement.py
Expand Up @@ -48,7 +48,9 @@ def _default_stage_id(self):
help="When the agreement starts.",
)
end_date = fields.Date(
string="End Date", track_visibility="onchange", help="When the agreement ends."
string="End Date",
track_visibility="onchange",
help="When the agreement ends."
)
color = fields.Integer()
active = fields.Boolean(
Expand Down Expand Up @@ -118,15 +120,25 @@ def _default_stage_id(self):
track_visibility="onchange",
help="Date that the contract was terminated.",
)
reviewed_date = fields.Date(string="Reviewed Date", track_visibility="onchange")
reviewed_date = fields.Date(
string="Reviewed Date",
track_visibility="onchange")
reviewed_user_id = fields.Many2one(
"res.users", string="Reviewed By", track_visibility="onchange"
"res.users",
string="Reviewed By",
track_visibility="onchange"
)
approved_date = fields.Date(string="Approved Date", 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"
"res.users",
string="Approved By",
track_visibility="onchange"
)
currency_id = fields.Many2one("res.currency", string="Currency")
currency_id = fields.Many2one(
"res.currency",
string="Currency")
partner_id = fields.Many2one(
"res.partner",
string="Partner",
Expand All @@ -146,10 +158,12 @@ def _default_stage_id(self):
help="The primary partner contact (If Applicable).",
)
partner_contact_phone = fields.Char(
related="partner_contact_id.phone", string="Phone"
related="partner_contact_id.phone",
string="Phone"
)
partner_contact_email = fields.Char(
related="partner_contact_id.email", string="Email"
related="partner_contact_id.email",
string="Email"
)
company_contact_id = fields.Many2one(
"res.partner",
Expand All @@ -158,10 +172,12 @@ def _default_stage_id(self):
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"
)
agreement_type_id = fields.Many2one(
"agreement.type",
Expand All @@ -176,7 +192,9 @@ def _default_stage_id(self):
help="Select the sub-type of this agreement. Sub-Types are related to "
"agreement types.",
)
product_ids = fields.Many2many("product.template", string="Products & Services")
product_ids = fields.Many2many(
"product.template",
string="Products & Services")
payment_term_id = fields.Many2one(
"account.payment.term",
string="Payment Term",
Expand Down Expand Up @@ -216,16 +234,28 @@ def _default_stage_id(self):
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
"agreement.section",
"agreement_id",
string="Sections",
copy=True
)
clauses_ids = fields.One2many(
"agreement.clause", "agreement_id", string="Clauses", copy=True
"agreement.clause",
"agreement_id",
string="Clauses",
copy=True
)
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",
Expand All @@ -242,10 +272,15 @@ def _default_stage_id(self):
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")],
[("draft", "Draft"),
("active", "Active"),
("inactive", "Inactive")],
default="draft",
track_visibility="always",
)
Expand All @@ -256,7 +291,9 @@ def _default_stage_id(self):
"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",
track_visibility="always")
field_id = fields.Many2one(
"ir.model.fields",
string="Field",
Expand Down Expand Up @@ -293,7 +330,8 @@ 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(
description = MailTemplates.with_context(
lang=lang)._render_template(
agreement.description, "agreement", agreement.id
)
agreement.dynamic_description = description
Expand All @@ -303,7 +341,8 @@ 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(
special_terms = MailTemplates.with_context(
lang=lang)._render_template(
agreement.special_terms, "agreement", agreement.id
)
agreement.dynamic_special_terms = special_terms
Expand Down Expand Up @@ -386,7 +425,8 @@ def create_new_agreement(self):
@api.model
def create(self, vals):
if vals.get("reference", _("New")) == _("New"):
vals["reference"] = self.env["ir.sequence"].next_by_code("agreement") or _(
vals["reference"] = self.env[
"ir.sequence"].next_by_code("agreement") or _(
"New"
)
return super(Agreement, self).create(vals)
Expand Down
1 change: 0 additions & 1 deletion agreement_legal/models/agreement_recital.py
Expand Up @@ -3,7 +3,6 @@

from odoo import api, fields, models


class AgreementRecital(models.Model):
_name = "agreement.recital"
_description = "Agreement Recitals"
Expand Down

0 comments on commit 731d9af

Please sign in to comment.