From 2efe22ccf07612e1d4cdb8e34950dc1ba99a39c6 Mon Sep 17 00:00:00 2001 From: Yves Goldberg Date: Tue, 2 Apr 2019 10:59:30 +0200 Subject: [PATCH] [FIX] agreement_legal: remove account dependency [FIX] ooops [UPD] README.rst --- agreement_legal/README.rst | 30 ++++--- agreement_legal/__manifest__.py | 2 +- agreement_legal/models/agreement.py | 90 +++++++------------ agreement_legal/models/agreement_recital.py | 33 ++++--- agreement_legal/models/agreement_section.py | 34 +++---- agreement_legal/static/description/index.html | 21 +++-- agreement_legal/views/agreement.xml | 6 -- 7 files changed, 94 insertions(+), 122 deletions(-) diff --git a/agreement_legal/README.rst b/agreement_legal/README.rst index 8a2f63079..430176782 100644 --- a/agreement_legal/README.rst +++ b/agreement_legal/README.rst @@ -1,6 +1,6 @@ -========== -Agreements -========== +================ +Agreements Legal +================ .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,16 +14,16 @@ Agreements :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github - :target: https://github.com/OCA/contract/tree/11.0/agreement + :target: https://github.com/OCA/contract/tree/12.0/agreement_legal :alt: OCA/contract .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-agreement + :target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_legal :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/110/11.0 + :target: https://runbot.odoo-community.org/runbot/110/12.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows you to manage agreements, letter of intent and contract content. The module is meant to be used by the legal team of a company and to allow them @@ -55,7 +55,7 @@ Usage To use this module: -* Go to Agreement > Agrements +* Go to Agreement > Agreements * Create a new agreement * Select a template * Follow the process to get the required approval @@ -74,7 +74,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -86,6 +86,7 @@ Authors * Pavlov Media * Open Source Integrators +* Yves Goldberg (Ygol Internetwork) Contributors ~~~~~~~~~~~~ @@ -95,6 +96,7 @@ Contributors * Wolfgang Hall * Maxime Chambreuil * Sandip Mangukiya +* Yves Goldberg Other credits ~~~~~~~~~~~~~ @@ -103,6 +105,7 @@ The development of this module has been financially supported by: * Pavlov Media * Open Source Integrators +* Yves Goldberg Maintainers ~~~~~~~~~~~ @@ -120,11 +123,14 @@ promote its widespread use. .. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px :target: https://github.com/max3903 :alt: max3903 +.. |maintainer-ygol| image:: https://github.com/ygol.png?size=40px + :target: https://github.com/ygol + :alt: ygol -Current `maintainer `__: +Current `maintainers `__: -|maintainer-max3903| +|maintainer-max3903| |maintainer-ygol| -This module is part of the `OCA/contract `_ project on GitHub. +This module is part of the `OCA/contract `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/agreement_legal/__manifest__.py b/agreement_legal/__manifest__.py index 543d9b9aa..d519218a2 100644 --- a/agreement_legal/__manifest__.py +++ b/agreement_legal/__manifest__.py @@ -12,7 +12,7 @@ "category": "Partner", "license": "AGPL-3", "version": "12.0.1.0.0", - "depends": ["contacts", "agreement", "mail", "product"], + "depends": ["contacts", "agreement", "product"], "data": [ "data/ir_sequence.xml", "data/module_category.xml", diff --git a/agreement_legal/models/agreement.py b/agreement_legal/models/agreement.py index 1046d6f03..4539024e2 100644 --- a/agreement_legal/models/agreement.py +++ b/agreement_legal/models/agreement.py @@ -50,7 +50,7 @@ class Agreement(models.Model): end_date = fields.Date( string="End Date", track_visibility="onchange", - help="When the agreement ends." + help="When the agreement ends.", ) color = fields.Integer() active = fields.Boolean( @@ -121,24 +121,18 @@ class Agreement(models.Model): help="Date that the contract was terminated.", ) reviewed_date = fields.Date( - string="Reviewed Date", - track_visibility="onchange") + 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_user_id = fields.Many2one( - "res.users", - string="Approved By", - track_visibility="onchange" + string="Approved Date", track_visibility="onchange" ) - currency_id = fields.Many2one( - "res.currency", - string="Currency") + approved_user_id = fields.Many2one( + "res.users", string="Approved By", track_visibility="onchange" + ) + currency_id = fields.Many2one("res.currency", string="Currency") partner_id = fields.Many2one( "res.partner", string="Partner", @@ -158,12 +152,10 @@ class Agreement(models.Model): 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", @@ -172,12 +164,10 @@ class Agreement(models.Model): 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", @@ -193,13 +183,7 @@ class Agreement(models.Model): "agreement types.", ) product_ids = fields.Many2many( - "product.template", - string="Products & Services") - payment_term_id = fields.Many2one( - "account.payment.term", - string="Payment Term", - track_visibility="onchange", - help="Terms of payments.", + "product.template", string="Products & Services" ) assigned_user_id = fields.Many2one( "res.users", @@ -234,28 +218,16 @@ class Agreement(models.Model): 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", @@ -275,12 +247,10 @@ class Agreement(models.Model): "agreement.line", "agreement_id", string="Products/Services", - copy=False + copy=False, ) state = fields.Selection( - [("draft", "Draft"), - ("active", "Active"), - ("inactive", "Inactive")], + [("draft", "Draft"), ("active", "Active"), ("inactive", "Inactive")], default="draft", track_visibility="always", ) @@ -292,8 +262,8 @@ class Agreement(models.Model): ) signed_contract_filename = fields.Char(string="Filename") signed_contract = fields.Binary( - string="Signed Document", - track_visibility="always") + string="Signed Document", track_visibility="always" + ) field_id = fields.Many2one( "ir.model.fields", string="Field", @@ -331,7 +301,8 @@ class Agreement(models.Model): for agreement in self: lang = agreement.partner_id.lang or "en_US" description = MailTemplates.with_context( - lang=lang)._render_template( + lang=lang + )._render_template( agreement.description, "agreement", agreement.id ) agreement.dynamic_description = description @@ -342,7 +313,8 @@ class Agreement(models.Model): for agreement in self: lang = agreement.partner_id.lang or "en_US" special_terms = MailTemplates.with_context( - lang=lang)._render_template( + lang=lang + )._render_template( agreement.special_terms, "agreement", agreement.id ) agreement.dynamic_special_terms = special_terms @@ -354,8 +326,7 @@ 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: @@ -425,10 +396,9 @@ class Agreement(models.Model): @api.model def create(self, vals): if vals.get("reference", _("New")) == _("New"): - vals["reference"] = self.env[ - "ir.sequence"].next_by_code("agreement") or _( - "New" - ) + vals["reference"] = self.env["ir.sequence"].next_by_code( + "agreement" + ) or _("New") return super(Agreement, self).create(vals) # Increments the revision on each save action diff --git a/agreement_legal/models/agreement_recital.py b/agreement_legal/models/agreement_recital.py index ec65c29e4..15b045170 100644 --- a/agreement_legal/models/agreement_recital.py +++ b/agreement_legal/models/agreement_recital.py @@ -12,11 +12,9 @@ class AgreementRecital(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." + 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", @@ -24,9 +22,8 @@ class AgreementRecital(models.Model): help="compute dynamic Content", ) agreement_id = fields.Many2one( - "agreement", - string="Agreement", - ondelete="cascade") + "agreement", string="Agreement", ondelete="cascade" + ) active = fields.Boolean( string="Active", default=True, @@ -65,24 +62,26 @@ class AgreementRecital(models.Model): template field.""", ) - @api.onchange('field_id', 'sub_model_object_field_id', 'default_value') + @api.onchange("field_id", "sub_model_object_field_id", "default_value") def onchange_copyvalue(self): self.sub_object_id = False self.copyvalue = False self.sub_object_id = False if self.field_id and not self.field_id.relation: - self.copyvalue = "${object.%s or %s}" % \ - (self.field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{} or {}}}".format( + self.field_id.name, self.default_value or "''" + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: - self.sub_object_id = self.env['ir.model'].search( - [('model', '=', self.field_id.relation)])[0] + self.sub_object_id = self.env["ir.model"].search( + [("model", "=", self.field_id.relation)] + )[0] if self.sub_model_object_field_id: - self.copyvalue = "${object.%s.%s or %s}" %\ - (self.field_id.name, - self.sub_model_object_field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{}.{} or {}}}".format( + self.field_id.name, + self.sub_model_object_field_id.name, + self.default_value or "''", + ) # compute the dynamic content for mako expression @api.multi diff --git a/agreement_legal/models/agreement_section.py b/agreement_legal/models/agreement_section.py index f278aae8c..2fe67ea9b 100644 --- a/agreement_legal/models/agreement_section.py +++ b/agreement_legal/models/agreement_section.py @@ -12,17 +12,15 @@ 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." + 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", string="Agreement", ondelete="cascade" + ) clauses_ids = fields.One2many( - "agreement.clause", - "section_id", - string="Clauses") + "agreement.clause", "section_id", string="Clauses" + ) content = fields.Html(string="Section Content") dynamic_content = fields.Html( compute="_compute_dynamic_content", @@ -67,24 +65,26 @@ class AgreementSection(models.Model): template field.""", ) - @api.onchange('field_id', 'sub_model_object_field_id', 'default_value') + @api.onchange("field_id", "sub_model_object_field_id", "default_value") def onchange_copyvalue(self): self.sub_object_id = False self.copyvalue = False self.sub_object_id = False if self.field_id and not self.field_id.relation: - self.copyvalue = "${object.%s or %s}" % \ - (self.field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{} or {}}}".format( + self.field_id.name, self.default_value or "''" + ) self.sub_model_object_field_id = False if self.field_id and self.field_id.relation: - self.sub_object_id = self.env['ir.model'].search( - [('model', '=', self.field_id.relation)])[0] + self.sub_object_id = self.env["ir.model"].search( + [("model", "=", self.field_id.relation)] + )[0] if self.sub_model_object_field_id: - self.copyvalue = "${object.%s.%s or %s}" %\ - (self.field_id.name, - self.sub_model_object_field_id.name, - self.default_value or '\'\'') + self.copyvalue = "${{object.{}.{} or {}}}".format( + self.field_id.name, + self.sub_model_object_field_id.name, + self.default_value or "''", + ) # compute the dynamic content for mako expression @api.multi diff --git a/agreement_legal/static/description/index.html b/agreement_legal/static/description/index.html index 7eb87fb0c..f11b08812 100644 --- a/agreement_legal/static/description/index.html +++ b/agreement_legal/static/description/index.html @@ -4,7 +4,7 @@ -Agreements +Agreements Legal -
-

Agreements

+
@@ -435,6 +435,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Pavlov Media
  • Open Source Integrators
  • +
  • Yves Goldberg (Ygol Internetwork)
@@ -445,6 +446,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Wolfgang Hall <whall@opensourceintegrators.com>
  • Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
  • Sandip Mangukiya <smangukiya@opensourceintegrators.com>
  • +
  • Yves Goldberg <yves@ygol.com>
  • @@ -453,6 +455,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
    • Pavlov Media
    • Open Source Integrators
    • +
    • Yves Goldberg
    @@ -462,9 +465,9 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    Current maintainer:

    -

    max3903

    -

    This module is part of the OCA/contract project on GitHub.

    +

    Current maintainers:

    +

    max3903 ygol

    +

    This module is part of the OCA/contract project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/agreement_legal/views/agreement.xml b/agreement_legal/views/agreement.xml index 83d229df8..868308484 100644 --- a/agreement_legal/views/agreement.xml +++ b/agreement_legal/views/agreement.xml @@ -130,12 +130,6 @@ - - - - - -