mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] agreement_serviceprofile: Github Issue #370
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from . import agreement_serviceprofile
|
||||
from . import agreement
|
||||
from . import agreement_stage
|
||||
from . import product
|
||||
|
||||
@@ -26,7 +26,8 @@ class AgreementServiceProfile(models.Model):
|
||||
|
||||
notes = fields.Text(string="Notes")
|
||||
product_id = fields.Many2one('product.template', 'Service Product',
|
||||
domain="[('type', '=', 'service')]",
|
||||
domain="[('is_serviceprofile', '=', True), "
|
||||
"('type', '=', 'service')]",
|
||||
required=True)
|
||||
partner_id = fields.Many2one(related='agreement_id.partner_id',
|
||||
string='Partner')
|
||||
|
||||
18
agreement_serviceprofile/models/product.py
Normal file
18
agreement_serviceprofile/models/product.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright (C) 2019 - TODAY, Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
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'
|
||||
Reference in New Issue
Block a user