mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] agreement_legal_sale: Github Issue #370
This commit is contained in:
committed by
Patrick Wilson
parent
4fb9254ba3
commit
510c6dfa1c
@@ -15,7 +15,6 @@
|
|||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
'views/agreement.xml',
|
'views/agreement.xml',
|
||||||
'views/product.xml',
|
|
||||||
'views/sale_order.xml',
|
'views/sale_order.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
from . import (
|
from . import (
|
||||||
sale_order,
|
sale_order,
|
||||||
agreement,
|
agreement,
|
||||||
product,
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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.""")
|
|
||||||
@@ -36,10 +36,11 @@ class SaleOrder(models.Model):
|
|||||||
'sale_line_id': line.id,
|
'sale_line_id': line.id,
|
||||||
'uom_id': line.product_uom.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:
|
if line.product_id.product_tmpl_id.is_serviceprofile:
|
||||||
self.env['agreement.serviceprofile'].create({
|
self.env['agreement.serviceprofile'].create({
|
||||||
'name': line.name,
|
'name': line.name,
|
||||||
|
'product_id': line.product_id.product_tmpl_id.id,
|
||||||
'agreement_id': order.agreement_id.id,
|
'agreement_id': order.agreement_id.id,
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo>
|
|
||||||
<!-- Copyright 2019 Open Source Integrators
|
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
|
||||||
|
|
||||||
<!-- 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="Agreement">
|
|
||||||
<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