[FIX] agreement_legal_sale: Github Issue #370

This commit is contained in:
Maxime Chambreuil
2019-09-05 12:18:45 -05:00
committed by Patrick Wilson
parent 4fb9254ba3
commit 510c6dfa1c
5 changed files with 2 additions and 41 deletions

View File

@@ -3,5 +3,4 @@
from . import (
sale_order,
agreement,
product,
)

View File

@@ -1,13 +0,0 @@
# Copyright (C) 2019 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
is_serviceprofile = fields.Boolean(
string="Create a Service Profile",
help="""If True, this product will create a service profile on the
agreement when the sales order is confirmed.""")

View File

@@ -36,10 +36,11 @@ class SaleOrder(models.Model):
'sale_line_id': line.id,
'uom_id': line.product_uom.id
})
# If the product is a service profile, create one
# If the product creates service profiles, create one
if line.product_id.product_tmpl_id.is_serviceprofile:
self.env['agreement.serviceprofile'].create({
'name': line.name,
'product_id': line.product_id.product_tmpl_id.id,
'agreement_id': order.agreement_id.id,
})
return res