From a6a722d7a89235065b89c1017ba9ce47e875df34 Mon Sep 17 00:00:00 2001 From: scampbell Date: Mon, 21 Sep 2020 10:57:42 -0700 Subject: [PATCH 1/5] [IMP] Product Variant on Serviceprofile [IMP] Allow Product Variant Serviceprofile [IMP] Add Variant To Tree/Form View [IMP] Boolean First --- .../models/agreement_serviceprofile.py | 7 +++++-- agreement_serviceprofile/models/product.py | 14 ++++++++++++++ agreement_serviceprofile/views/agreement.xml | 5 ++++- .../views/agreement_serviceprofile.xml | 8 +++++++- agreement_serviceprofile/views/product.xml | 19 +++++++++++++++++++ 5 files changed, 49 insertions(+), 4 deletions(-) diff --git a/agreement_serviceprofile/models/agreement_serviceprofile.py b/agreement_serviceprofile/models/agreement_serviceprofile.py index 6f676bf67..c2b2289dd 100644 --- a/agreement_serviceprofile/models/agreement_serviceprofile.py +++ b/agreement_serviceprofile/models/agreement_serviceprofile.py @@ -28,8 +28,11 @@ class AgreementServiceProfile(models.Model): notes = fields.Text(string="Notes") product_id = fields.Many2one('product.template', 'Service Product', domain="[('is_serviceprofile', '=', True), " - "('type', '=', 'service')]", - required=True) + "('type', '=', 'service')]") + product_variant_id = fields.Many2one('product.product', 'Service Product Variant', + domain="[('is_serviceprofile', '=', True), " + "('type', '=', 'service')]") + use_product_variant = fields.Boolean('Use Product Variant', default=False) partner_id = fields.Many2one(related='agreement_id.partner_id', string='Partner') diff --git a/agreement_serviceprofile/models/product.py b/agreement_serviceprofile/models/product.py index afde8de02..55a216989 100644 --- a/agreement_serviceprofile/models/product.py +++ b/agreement_serviceprofile/models/product.py @@ -16,3 +16,17 @@ class ProductTemplate(models.Model): def onchange_type(self): if self.is_serviceprofile: self.type = 'service' + + +class ProductProduct(models.Model): + _inherit = 'product.product' + + is_serviceprofile = fields.Boolean( + string="Create Service Profiles", + help="""If True, this product will create a service profile on the + agreement when the sales order is confirmed.""") + + @api.onchange('is_serviceprofile') + def onchange_type(self): + if self.is_serviceprofile: + self.type = 'service' diff --git a/agreement_serviceprofile/views/agreement.xml b/agreement_serviceprofile/views/agreement.xml index c7e605b84..cd5107e67 100644 --- a/agreement_serviceprofile/views/agreement.xml +++ b/agreement_serviceprofile/views/agreement.xml @@ -12,6 +12,7 @@ +
@@ -19,7 +20,9 @@ - + + + diff --git a/agreement_serviceprofile/views/agreement_serviceprofile.xml b/agreement_serviceprofile/views/agreement_serviceprofile.xml index 55a4e56a2..e5ba00b0c 100644 --- a/agreement_serviceprofile/views/agreement_serviceprofile.xml +++ b/agreement_serviceprofile/views/agreement_serviceprofile.xml @@ -11,6 +11,7 @@ + @@ -47,7 +48,9 @@ - + + + @@ -96,6 +99,9 @@ + diff --git a/agreement_serviceprofile/views/product.xml b/agreement_serviceprofile/views/product.xml index d5b0571d9..e227fdabb 100644 --- a/agreement_serviceprofile/views/product.xml +++ b/agreement_serviceprofile/views/product.xml @@ -21,4 +21,23 @@ + + + product.product.form.view + product.product + + + + + + + + + + + + + + + From 49d5eb66d7edddc3b9754ee49d5252089e7b0828 Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Mon, 28 Sep 2020 15:52:49 -0700 Subject: [PATCH 2/5] Update agreement_serviceprofile/views/agreement.xml Co-authored-by: Bhavesh Odedra --- agreement_serviceprofile/views/agreement.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agreement_serviceprofile/views/agreement.xml b/agreement_serviceprofile/views/agreement.xml index cd5107e67..cfb1978e3 100644 --- a/agreement_serviceprofile/views/agreement.xml +++ b/agreement_serviceprofile/views/agreement.xml @@ -21,7 +21,7 @@ - + From 9786f03e25779bfa0d1d505ababac254043bd5ec Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Mon, 28 Sep 2020 15:52:55 -0700 Subject: [PATCH 3/5] Update agreement_serviceprofile/views/agreement_serviceprofile.xml Co-authored-by: Bhavesh Odedra --- agreement_serviceprofile/views/agreement_serviceprofile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agreement_serviceprofile/views/agreement_serviceprofile.xml b/agreement_serviceprofile/views/agreement_serviceprofile.xml index e5ba00b0c..169d96c8e 100644 --- a/agreement_serviceprofile/views/agreement_serviceprofile.xml +++ b/agreement_serviceprofile/views/agreement_serviceprofile.xml @@ -48,7 +48,7 @@ - + From 33cdb1ef9bc6d1223b2d3e512d26c4e80dd10fc3 Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Mon, 28 Sep 2020 15:53:02 -0700 Subject: [PATCH 4/5] Update agreement_serviceprofile/views/agreement_serviceprofile.xml Co-authored-by: Bhavesh Odedra --- agreement_serviceprofile/views/agreement_serviceprofile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agreement_serviceprofile/views/agreement_serviceprofile.xml b/agreement_serviceprofile/views/agreement_serviceprofile.xml index 169d96c8e..b680b433f 100644 --- a/agreement_serviceprofile/views/agreement_serviceprofile.xml +++ b/agreement_serviceprofile/views/agreement_serviceprofile.xml @@ -49,7 +49,7 @@ - + From c70a12021a27ae1c971db80fc1b84decc2919bcd Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Mon, 28 Sep 2020 15:53:09 -0700 Subject: [PATCH 5/5] Update agreement_serviceprofile/views/agreement.xml Co-authored-by: Bhavesh Odedra --- agreement_serviceprofile/views/agreement.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agreement_serviceprofile/views/agreement.xml b/agreement_serviceprofile/views/agreement.xml index cfb1978e3..3cb0784e2 100644 --- a/agreement_serviceprofile/views/agreement.xml +++ b/agreement_serviceprofile/views/agreement.xml @@ -22,7 +22,7 @@ - +