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:
@@ -15,8 +15,9 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'data/serviceprofile_stage.xml',
|
'data/serviceprofile_stage.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
|
'views/product.xml',
|
||||||
'views/agreement_serviceprofile.xml',
|
'views/agreement_serviceprofile.xml',
|
||||||
'views/agreement.xml'
|
'views/agreement.xml',
|
||||||
],
|
],
|
||||||
'development_status': 'Beta',
|
'development_status': 'Beta',
|
||||||
'maintainers': [
|
'maintainers': [
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
from . import agreement_serviceprofile
|
from . import agreement_serviceprofile
|
||||||
from . import agreement
|
from . import agreement
|
||||||
from . import agreement_stage
|
from . import agreement_stage
|
||||||
|
from . import product
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ class AgreementServiceProfile(models.Model):
|
|||||||
|
|
||||||
notes = fields.Text(string="Notes")
|
notes = fields.Text(string="Notes")
|
||||||
product_id = fields.Many2one('product.template', 'Service Product',
|
product_id = fields.Many2one('product.template', 'Service Product',
|
||||||
domain="[('type', '=', 'service')]",
|
domain="[('is_serviceprofile', '=', True), "
|
||||||
|
"('type', '=', 'service')]",
|
||||||
required=True)
|
required=True)
|
||||||
partner_id = fields.Many2one(related='agreement_id.partner_id',
|
partner_id = fields.Many2one(related='agreement_id.partner_id',
|
||||||
string='Partner')
|
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'
|
||||||
24
agreement_serviceprofile/views/product.xml
Normal file
24
agreement_serviceprofile/views/product.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!-- Copyright 2019 Open Source Integrators
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<!-- Product Template Form View -->
|
||||||
|
<record id="product_template_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.form.view</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//notebook" position="inside">
|
||||||
|
<page id="agreement" string="Service">
|
||||||
|
<group>
|
||||||
|
<group id="agreement_left">
|
||||||
|
<field name="is_serviceprofile"/>
|
||||||
|
</group>
|
||||||
|
<group id="agreement_right"/>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user