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 + + + + + + + + + + + + + + +