diff --git a/agreement_legal/data/agreement_stage.xml b/agreement_legal/data/agreement_stage.xml index cef2b25e..66e399ef 100644 --- a/agreement_legal/data/agreement_stage.xml +++ b/agreement_legal/data/agreement_stage.xml @@ -4,46 +4,55 @@ New 10 + agreement Draft 20 + agreement Reviewed 30 + agreement Negotiation 40 + agreement Out for Customer Signature 50 + agreement Waiting Internal Signature 60 + agreement Active 70 + agreement Expired 80 + agreement Cancelled 100 True + agreement diff --git a/agreement_legal/models/agreement.py b/agreement_legal/models/agreement.py index fb5f1205..9421dafe 100644 --- a/agreement_legal/models/agreement.py +++ b/agreement_legal/models/agreement.py @@ -309,7 +309,8 @@ class Agreement(models.Model): # Used for Kanban grouped_by view @api.model def _read_group_stage_ids(self, stages, domain, order): - stage_ids = self.env["agreement.stage"].search([]) + stage_ids = self.env["agreement.stage"].search( + [('stage_type', '=', 'agreement')]) return stage_ids stage_id = fields.Many2one( diff --git a/agreement_legal/models/agreement_stage.py b/agreement_legal/models/agreement_stage.py index 05cbb459..2c42106f 100644 --- a/agreement_legal/models/agreement_stage.py +++ b/agreement_legal/models/agreement_stage.py @@ -24,5 +24,8 @@ class AgreementStage(models.Model): fold = fields.Boolean( string="Is Folded", required=False, - help="This stage is folded in the kanban view by deafault.", + help="This stage is folded in the kanban view by default.", ) + stage_type = fields.Selection( + [('agreement', 'Agreement')], + string='Type', required=True) diff --git a/agreement_legal/views/agreement.xml b/agreement_legal/views/agreement.xml index 72774995..f339d1aa 100644 --- a/agreement_legal/views/agreement.xml +++ b/agreement_legal/views/agreement.xml @@ -36,7 +36,7 @@
diff --git a/agreement_legal/views/agreement_stages.xml b/agreement_legal/views/agreement_stages.xml index fdb41380..30168d2e 100644 --- a/agreement_legal/views/agreement_stages.xml +++ b/agreement_legal/views/agreement_stages.xml @@ -9,6 +9,7 @@ + @@ -26,6 +27,7 @@
+
diff --git a/agreement_serviceprofile/__manifest__.py b/agreement_serviceprofile/__manifest__.py index 58748f12..4e104fd5 100644 --- a/agreement_serviceprofile/__manifest__.py +++ b/agreement_serviceprofile/__manifest__.py @@ -13,6 +13,7 @@ 'license': 'AGPL-3', 'depends': ['agreement_legal'], 'data': [ + 'data/serviceprofile_stage.xml', 'security/ir.model.access.csv', 'views/agreement_serviceprofile.xml', 'views/agreement.xml' diff --git a/agreement_serviceprofile/data/serviceprofile_stage.xml b/agreement_serviceprofile/data/serviceprofile_stage.xml new file mode 100644 index 00000000..584c47e5 --- /dev/null +++ b/agreement_serviceprofile/data/serviceprofile_stage.xml @@ -0,0 +1,41 @@ + + + + + Draft + 10 + serviceprofile + + + + In Progress + 20 + serviceprofile + + + + Suspended + 30 + serviceprofile + + + + To Renew + 40 + serviceprofile + + + + Closed + 50 + serviceprofile + + + + Cancelled + 60 + True + serviceprofile + + + diff --git a/agreement_serviceprofile/models/__init__.py b/agreement_serviceprofile/models/__init__.py index a0e6354c..b0ff00e0 100644 --- a/agreement_serviceprofile/models/__init__.py +++ b/agreement_serviceprofile/models/__init__.py @@ -1,2 +1,3 @@ from . import agreement_serviceprofile from . import agreement +from . import agreement_stage diff --git a/agreement_serviceprofile/models/agreement_serviceprofile.py b/agreement_serviceprofile/models/agreement_serviceprofile.py index a645b5ee..3ec22e8d 100644 --- a/agreement_serviceprofile/models/agreement_serviceprofile.py +++ b/agreement_serviceprofile/models/agreement_serviceprofile.py @@ -2,14 +2,20 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import fields, models, api class AgreementServiceProfile(models.Model): _name = 'agreement.serviceprofile' _description = 'Agreement Service Profiles' + def _default_stage_id(self): + return self.env.ref('agreement_serviceprofile.servpro_stage_draft') + name = fields.Char(string="Name", required=True) + stage_id = fields.Many2one('agreement.stage', string="Stage", + default=_default_stage_id, copy=False, + group_expand='_read_group_stage_ids',) agreement_id = fields.Many2one('agreement', string="Agreement", ondelete="cascade") active = fields.Boolean(string="Active", @@ -19,3 +25,12 @@ class AgreementServiceProfile(models.Model): " without removing it.") notes = fields.Text(string="Notes") + product_id = fields.Many2one('product.template', 'Service', + domain="[('type', '=', 'service')]") + + # Used for Kanban grouped_by view + @api.model + def _read_group_stage_ids(self, stages, domain, order): + stage_ids = self.env["agreement.stage"].search( + [('stage_type', '=', 'serviceprofile')]) + return stage_ids diff --git a/agreement_serviceprofile/models/agreement_stage.py b/agreement_serviceprofile/models/agreement_stage.py new file mode 100644 index 00000000..cf578022 --- /dev/null +++ b/agreement_serviceprofile/models/agreement_stage.py @@ -0,0 +1,12 @@ +# Copyright (C) 2019 - TODAY, Brian McMaster +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AgreementStage(models.Model): + _inherit = 'agreement.stage' + + stage_type = fields.Selection( + selection_add=[('serviceprofile', 'Service Profile')] + ) diff --git a/agreement_serviceprofile/readme/CONTRIBUTORS.rst b/agreement_serviceprofile/readme/CONTRIBUTORS.rst index 1869cddb..4f31127a 100644 --- a/agreement_serviceprofile/readme/CONTRIBUTORS.rst +++ b/agreement_serviceprofile/readme/CONTRIBUTORS.rst @@ -4,3 +4,4 @@ * Maxime Chambreuil * Sandip Mangukiya * Serpent Consulting Services Pvt. Ltd. +* Brian McMaster diff --git a/agreement_serviceprofile/views/agreement_serviceprofile.xml b/agreement_serviceprofile/views/agreement_serviceprofile.xml index f8c1571f..e227240e 100644 --- a/agreement_serviceprofile/views/agreement_serviceprofile.xml +++ b/agreement_serviceprofile/views/agreement_serviceprofile.xml @@ -9,6 +9,7 @@ + @@ -20,6 +21,12 @@ agreement.serviceprofile
+
+ +