mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[ADD] agreement 11.0.0.1.0
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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',
|
||||
|
||||
24
agreement/models/agreement_appendix.py
Normal file
24
agreement/models/agreement_appendix.py
Normal file
@@ -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.")
|
||||
@@ -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)
|
||||
|
||||
24
agreement/models/agreement_recital.py
Normal file
24
agreement/models/agreement_recital.py
Normal file
@@ -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.")
|
||||
@@ -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)
|
||||
|
||||
18
agreement/models/agreement_serviceprofile.py
Normal file
18
agreement/models/agreement_serviceprofile.py
Normal file
@@ -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.")
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user