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 .

Agreement

+

Recitals

+ + + + + + +
+
    +
  1. + +

    + +

    +

  2. +
+
  1. -

    + +

    +

    1. -

      + +

      +

    @@ -65,10 +86,12 @@

-

Special Terms

-
-

-

+ +

Special Terms

+
+

+

+

Signatures

@@ -105,6 +128,13 @@
+
+
+

+

+

+
diff --git a/agreement/security/ir.model.access.csv b/agreement/security/ir.model.access.csv index f9afeb06..9210b66a 100644 --- a/agreement/security/ir.model.access.csv +++ b/agreement/security/ir.model.access.csv @@ -1,10 +1,16 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_agreement_allusers,agreement all users,model_agreement,agreement.group_agreement_user,1,1,1,0 access_agreement_manager,agreement manager,model_agreement,agreement.group_agreement_manager,1,1,1,1 +access_agreement_recital_allusers,recital all users,model_agreement_recital,agreement.group_agreement_user,1,1,1,0 +access_agreement_recital_manager,recital manager,model_agreement_recital,agreement.group_agreement_manager,1,1,1,1 access_agreement_section_allusers,section all users,model_agreement_section,agreement.group_agreement_user,1,1,1,0 access_agreement_section_manager,section manager,model_agreement_section,agreement.group_agreement_manager,1,1,1,1 access_agreement_clause_allusers,clause all users,model_agreement_clause,agreement.group_agreement_user,1,1,1,0 access_agreement_clause_manager,clause manager,model_agreement_clause,agreement.group_agreement_manager,1,1,1,1 +access_agreement_appendix_allusers,appendix all users,model_agreement_appendix,agreement.group_agreement_user,1,1,1,0 +access_agreement_appendix_manager,appendix manager,model_agreement_appendix,agreement.group_agreement_manager,1,1,1,1 +access_agreement_servprof_allusers,service profile all users,model_agreement_serviceprofile,agreement.group_agreement_user,1,1,1,0 +access_agreement_servprof_manager,service profile manager,model_agreement_serviceprofile,agreement.group_agreement_manager,1,1,1,1 access_agreement_stage_allusers,stage all users,model_agreement_stage,agreement.group_agreement_user,1,0,0,0 access_agreement_stage_manager,stage manager,model_agreement_stage,agreement.group_agreement_manager,1,1,1,1 access_agreement_type_allusers,type all users,model_agreement_type,agreement.group_agreement_user,1,0,0,0 diff --git a/agreement/views/agreement.xml b/agreement/views/agreement.xml index 5c6268a1..c0d7aee3 100644 --- a/agreement/views/agreement.xml +++ b/agreement/views/agreement.xml @@ -6,7 +6,7 @@ Agreement List agreement - + @@ -120,27 +120,26 @@ + +
+
+ + + + + + + + + + + + + + + + + + Agreement Appendix Search + agreement.appendix + + + + + + + + + + Appendices + agreement.appendix + tree,form + + + diff --git a/agreement/views/agreement_clause.xml b/agreement/views/agreement_clause.xml index c25cc404..9d0d9dfe 100644 --- a/agreement/views/agreement_clause.xml +++ b/agreement/views/agreement_clause.xml @@ -1,25 +1,17 @@ - - - agreement_clause_sequencer - agreement.clause - 0 - 1 - - Agreement Clause List agreement.clause - - - + + + + - @@ -30,31 +22,28 @@ Agreement clause Form agreement.clause -
+ +
+ +
-
- - - + + + + + + + + - - - THIS IS UNDER DEVELOPEMENT: The purpose of this section is to be able to create dynamic fields inside your content. - - - - - - - - - - - Sequence # +
@@ -72,24 +61,11 @@
- - - Agreement Clause Pivot - agreement.clause - - - - - - - - - - Agreement Clauses + Clauses agreement.clause - tree,pivot,form + tree,form
diff --git a/agreement/views/agreement_recital.xml b/agreement/views/agreement_recital.xml new file mode 100644 index 00000000..b963c254 --- /dev/null +++ b/agreement/views/agreement_recital.xml @@ -0,0 +1,68 @@ + + + + + + Agreement Recital Tree + agreement.recital + + + + + + + + + + + + + + Agreement Recital Form + agreement.recital + +
+ +
+ +
+
+
+ + + + + + + + + + +
+
+
+
+ + + + Agreement Recital Search + agreement.recital + + + + + + + + + + Recitals + agreement.recital + tree,form + + +
diff --git a/agreement/views/agreement_section.xml b/agreement/views/agreement_section.xml index 3e3e5f51..7c660df7 100644 --- a/agreement/views/agreement_section.xml +++ b/agreement/views/agreement_section.xml @@ -1,23 +1,16 @@ - - - agreement_section_sequencer - agreement.section - 0 - 1 - - Agreement Section List agreement.section - - - - + + + + + @@ -28,41 +21,42 @@ Agreement Section Form agreement.section -
+ +
+ +
-
- - - - + + + + + + + + + + - + - + - + - - THIS IS UNDER DEVELOPEMENT: The purpose of this section is to be able to create dynamic fields inside your content. - - - - - - - - - - Sequence #
diff --git a/agreement/views/agreement_serviceprofile.xml b/agreement/views/agreement_serviceprofile.xml new file mode 100644 index 00000000..1ab953c3 --- /dev/null +++ b/agreement/views/agreement_serviceprofile.xml @@ -0,0 +1,62 @@ + + + + + + Agreement Service Profile Tree + agreement.serviceprofile + + + + + + + + + + + + Agreement Service Profile Form + agreement.serviceprofile + +
+ +
+ +
+
+
+ + + + + + +
+
+
+
+ + + + Agreement Service Profile Search + agreement.serviceprofile + + + + + + + + + + Service Profiles + agreement.serviceprofile + tree,form + + +
diff --git a/agreement/views/agreement_subtype.xml b/agreement/views/agreement_subtype.xml index 51ef1986..f311e6ce 100644 --- a/agreement/views/agreement_subtype.xml +++ b/agreement/views/agreement_subtype.xml @@ -20,12 +20,15 @@
+
+
- - - - + + + +
diff --git a/agreement/views/agreement_type.xml b/agreement/views/agreement_type.xml index e551d1a4..c7d4a688 100644 --- a/agreement/views/agreement_type.xml +++ b/agreement/views/agreement_type.xml @@ -6,7 +6,7 @@ Agreement Type List agreement.type - + @@ -18,14 +18,14 @@ Agreement Type Form agreement.type -
+ - - - - - - +
+
+
@@ -33,7 +33,7 @@ - Agreement Type + Agreement Types agreement.type tree,form diff --git a/agreement/views/menu.xml b/agreement/views/menu.xml index 8cde6f52..fb0e91e1 100644 --- a/agreement/views/menu.xml +++ b/agreement/views/menu.xml @@ -42,21 +42,44 @@ parent="agreement_root" sequence="30"/> + + + +