diff --git a/agreement/__manifest__.py b/agreement/__manifest__.py index a762c8ef..c0856d65 100644 --- a/agreement/__manifest__.py +++ b/agreement/__manifest__.py @@ -10,7 +10,7 @@ 'website': 'https://github.com/OCA/contract', 'category': 'Partner', 'license': 'AGPL-3', - 'version': '11.0.0.0.1', + 'version': '11.0.0.1.0', 'depends': [ 'account', 'contacts', @@ -27,8 +27,11 @@ 'report/agreement.xml', 'views/res_config_settings.xml', 'views/agreement.xml', + 'views/agreement_appendix.xml', 'views/agreement_clause.xml', + 'views/agreement_recital.xml', 'views/agreement_section.xml', + 'views/agreement_serviceprofile.xml', 'views/agreement_stages.xml', 'views/agreement_type.xml', 'views/agreement_subtype.xml', diff --git a/agreement/models/__init__.py b/agreement/models/__init__.py index 6502942f..54733bfb 100644 --- a/agreement/models/__init__.py +++ b/agreement/models/__init__.py @@ -4,8 +4,11 @@ from . import ( res_config_settings, account, agreement, + agreement_appendix, agreement_clause, + agreement_recital, agreement_section, + agreement_serviceprofile, agreement_stage, agreement_type, agreement_subtype, diff --git a/agreement/models/agreement.py b/agreement/models/agreement.py index 92afa39f..7402de27 100644 --- a/agreement/models/agreement.py +++ b/agreement/models/agreement.py @@ -265,18 +265,18 @@ class Agreement(models.Model): string="Service Order Lines", copy=False ) - sections_ids = fields.One2many( - 'agreement.section', - 'agreement_id', - string="Sections", - copy=True - ) - clauses_ids = fields.One2many( - 'agreement.clause', - 'agreement_id', - string="Clauses", - copy=True - ) + recital_ids = fields.One2many('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", copy=True) + appendix_ids = fields.One2many('agreement.appendix', 'agreement_id', + string="Appendices", copy=True) + serviceprofile_ids = fields.One2many('agreement.serviceprofile', + 'agreement_id', + string="Service Profiles", + readonly=True) analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account', index=True) analytic_line_ids = fields.One2many('account.analytic.line', diff --git a/agreement/models/agreement_appendix.py b/agreement/models/agreement_appendix.py new file mode 100644 index 00000000..97fc9352 --- /dev/null +++ b/agreement/models/agreement_appendix.py @@ -0,0 +1,24 @@ +# Copyright (C) 2018 - TODAY, Pavlov Media +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AgreementAppendix(models.Model): + _name = 'agreement.appendix' + _description = 'Agreement Appendices' + _order = "sequence" + + name = fields.Char(string="Name", required=True) + title = fields.Char(string="Title", required=True, + help="The title is displayed on the PDF." + "The name is not.") + sequence = fields.Integer(string="Sequence", default=10) + content = fields.Html(string="Content") + agreement_id = fields.Many2one('agreement', string="Agreement", + ondelete="cascade") + active = fields.Boolean( + string="Active", + default=True, + help="If unchecked, it will allow you to hide this appendix without " + "removing it.") diff --git a/agreement/models/agreement_clause.py b/agreement/models/agreement_clause.py index 765d951f..63c54f93 100644 --- a/agreement/models/agreement_clause.py +++ b/agreement/models/agreement_clause.py @@ -1,22 +1,19 @@ # Copyright (C) 2018 - TODAY, Pavlov Media # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api +from odoo import fields, models -# Main Agreement clause Records Model class AgreementClause(models.Model): _name = 'agreement.clause' - _order = 'clause_sequence' + _description = 'Agreement Clauses' + _order = 'sequence' - # General - name = fields.Char( - string="Title", - required=True - ) - clause_sequence = fields.Integer( - string="Sequence" - ) + name = fields.Char(string="Name", required=True) + title = fields.Char(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", @@ -27,54 +24,10 @@ class AgreementClause(models.Model): string="Section", ondelete="cascade" ) - content = fields.Html( - string="Clause Content" - ) + content = fields.Html(string="Clause Content") active = fields.Boolean( string="Active", default=True, help="If unchecked, it will allow you to hide the agreement without " "removing it." ) - - # Placeholder fields - model_id = fields.Many2one( - 'ir.model', - string="Applies to", - help="The type of document this template can be used with." - ) - model_object_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." - ) - 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." - ) - 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)." - ) - null_value = fields.Char( - string="Default Value", - 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." - ) - - @api.model - def create(self, vals): - seq = self.env['ir.sequence'].next_by_code('agreement.clause') or '/' - vals['clause_sequence'] = seq - return super(AgreementClause, self).create(vals) diff --git a/agreement/models/agreement_recital.py b/agreement/models/agreement_recital.py new file mode 100644 index 00000000..e5002fea --- /dev/null +++ b/agreement/models/agreement_recital.py @@ -0,0 +1,24 @@ +# Copyright (C) 2018 - TODAY, Pavlov Media +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AgreementRecital(models.Model): + _name = 'agreement.recital' + _description = 'Agreement Recitals' + _order = "sequence" + + name = fields.Char(string="Name", required=True) + title = fields.Char(string="Title", + help="The title is displayed on the PDF." + "The name is not.") + sequence = fields.Integer(string="Sequence", default=10) + content = fields.Html(string="Content") + agreement_id = fields.Many2one('agreement', string="Agreement", + ondelete="cascade") + active = fields.Boolean( + string="Active", + default=True, + help="If unchecked, it will allow you to hide this recital without " + "removing it.") diff --git a/agreement/models/agreement_section.py b/agreement/models/agreement_section.py index 09c9acdd..7f89749f 100644 --- a/agreement/models/agreement_section.py +++ b/agreement/models/agreement_section.py @@ -1,22 +1,19 @@ # Copyright (C) 2018 - TODAY, Pavlov Media # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields, api +from odoo import fields, models -# Main Agreement Section Records Model class AgreementSection(models.Model): _name = 'agreement.section' - _order = 'section_sequence' + _description = 'Agreement Sections' + _order = 'sequence' - # General - name = fields.Char( - string="Title", - required=True - ) - section_sequence = fields.Integer( - string="Sequence" - ) + name = fields.Char(string="Name", required=True) + title = fields.Char(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", @@ -27,54 +24,10 @@ class AgreementSection(models.Model): 'section_id', string="Clauses" ) - content = fields.Html( - string="Section Content" - ) + content = fields.Html(string="Section Content") active = fields.Boolean( string="Active", default=True, help="If unchecked, it will allow you to hide the agreement without " "removing it." ) - - # Placeholder fields - model_id = fields.Many2one( - 'ir.model', - string="Applies to", - help="The type of document this template can be used with." - ) - model_object_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." - ) - 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." - ) - 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)." - ) - null_value = fields.Char( - string="Default Value", - 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." - ) - - @api.model - def create(self, vals): - seq = self.env['ir.sequence'].next_by_code('agreement.section') or '/' - vals['section_sequence'] = seq - return super(AgreementSection, self).create(vals) diff --git a/agreement/models/agreement_serviceprofile.py b/agreement/models/agreement_serviceprofile.py new file mode 100644 index 00000000..05e25f92 --- /dev/null +++ b/agreement/models/agreement_serviceprofile.py @@ -0,0 +1,18 @@ +# Copyright (C) 2018 - TODAY, Pavlov Media +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AgreementServiceProfile(models.Model): + _name = 'agreement.serviceprofile' + _description = 'Agreement Service Profiles' + + name = fields.Char(string="Name", required=True) + agreement_id = fields.Many2one('agreement', string="Agreement", + ondelete="cascade") + active = fields.Boolean( + string="Active", + default=True, + help="If unchecked, it will allow you to hide this service profile" + " without removing it.") diff --git a/agreement/models/agreement_stage.py b/agreement/models/agreement_stage.py index beb8dd43..71c10aab 100644 --- a/agreement/models/agreement_stage.py +++ b/agreement/models/agreement_stage.py @@ -7,6 +7,7 @@ from odoo import models, fields # Main Agreement Section Records Model class AgreementStage(models.Model): _name = 'agreement.stage' + _description = 'Agreement Stages' _order = 'sequence' # General diff --git a/agreement/models/agreement_status.py b/agreement/models/agreement_status.py deleted file mode 100644 index 6d6a190c..00000000 --- a/agreement/models/agreement_status.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2018 - TODAY, Pavlov Media -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import models, fields - - -# Main Agreement Status Records Model -class AgreementStatus(models.Model): - _name = 'agreement.type' - - # General - name = fields.Char( - string="Title", - required=True - ) diff --git a/agreement/models/agreement_subtype.py b/agreement/models/agreement_subtype.py index 1959e02a..431be15a 100644 --- a/agreement/models/agreement_subtype.py +++ b/agreement/models/agreement_subtype.py @@ -1,19 +1,13 @@ # Copyright (C) 2018 - TODAY, Pavlov Media # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields +from odoo import fields, models -# Main Agreement Section Records Model class AgreementSubtype(models.Model): _name = 'agreement.subtype' + _description = 'Agreement Subtypes' - # General - name = fields.Char( - string="Title", - required=True - ) - agreement_type_id = fields.Many2one( - 'agreement.type', - string="Agreement Type" - ) + name = fields.Char(string="Name", required=True) + agreement_type_id = fields.Many2one('agreement.type', + string="Agreement Type") diff --git a/agreement/models/agreement_type.py b/agreement/models/agreement_type.py index b87cc489..bfe6bb36 100644 --- a/agreement/models/agreement_type.py +++ b/agreement/models/agreement_type.py @@ -1,20 +1,14 @@ # Copyright (C) 2018 - TODAY, Pavlov Media # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields +from odoo import fields, models -# Main Agreement Section Records Model class AgreementType(models.Model): _name = 'agreement.type' + _description = 'Agreement Types' - # General - name = fields.Char( - string="Title", - required=True - ) - agreement_subtypes_ids = fields.One2many( - 'agreement.subtype', - 'agreement_type_id', - string="Agreement" - ) + name = fields.Char(string="Name", required=True) + agreement_subtypes_ids = fields.One2many('agreement.subtype', + 'agreement_type_id', + string="Subtypes") diff --git a/agreement/models/product_template.py b/agreement/models/product_template.py index cfd3516b..b3f92975 100644 --- a/agreement/models/product_template.py +++ b/agreement/models/product_template.py @@ -7,7 +7,4 @@ from odoo import models, fields class Product(models.Model): _inherit = 'product.template' - agreements_ids = fields.Many2many( - 'agreement', - string="Agreements" - ) + agreements_ids = fields.Many2many('agreement', string="Agreements") diff --git a/agreement/models/res_partner.py b/agreement/models/res_partner.py index e1523606..5ad056dd 100644 --- a/agreement/models/res_partner.py +++ b/agreement/models/res_partner.py @@ -6,5 +6,6 @@ from odoo import models, fields class Partner(models.Model): _inherit = 'res.partner' + agreement_ids = fields.One2many('agreement', 'partner_id', string="Agreements") diff --git a/agreement/report/agreement.xml b/agreement/report/agreement.xml index f763a7b1..ec3290f3 100644 --- a/agreement/report/agreement.xml +++ b/agreement/report/agreement.xml @@ -45,17 +45,38 @@ Represented by .
+
|
+
|
This section is a place where financial records will show the current performance of this agreement.
Perhaps include invoices with total vs costs?