Browse Source
Merge pull request #257 from ursais/11.0-fixes
[IMP] agreement_sale
pull/267/head
Maxime Chambreuil
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with
60 additions and
21 deletions
-
agreement_sale/__init__.py
-
agreement_sale/__manifest__.py
-
agreement_sale/models/__init__.py
-
agreement_sale/models/agreement.py
-
agreement_sale/models/product.py
-
agreement_sale/models/sale_order.py
-
agreement_sale/views/agreement.xml
-
agreement_sale/views/product.xml
-
agreement_sale/views/sale_order.xml
|
|
@ -1,3 +1,4 @@ |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|
|
|
# Copyright (C) 2019 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from . import models |
|
|
@ -1,5 +1,5 @@ |
|
|
|
# Copyright (C) 2018 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|
|
|
# Copyright (C) 2019 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
{ |
|
|
|
'name': 'Agreement - Sale', |
|
|
@ -15,7 +15,8 @@ |
|
|
|
], |
|
|
|
'data': [ |
|
|
|
'views/agreement.xml', |
|
|
|
'views/sale_order.xml' |
|
|
|
'views/product.xml', |
|
|
|
'views/sale_order.xml', |
|
|
|
], |
|
|
|
'installable': True, |
|
|
|
'development_status': 'Beta', |
|
|
|
|
|
@ -1,6 +1,8 @@ |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|
|
|
# Copyright (C) 2019 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from . import ( |
|
|
|
sale_order, |
|
|
|
agreement, |
|
|
|
product, |
|
|
|
) |
|
|
@ -1,5 +1,5 @@ |
|
|
|
# Copyright (C) 2018 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|
|
|
# Copyright (C) 2019 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
from odoo import fields, models |
|
|
|
|
|
|
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
# 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.""") |
|
|
@ -1,5 +1,5 @@ |
|
|
|
# Copyright (C) 2018 - TODAY, Open Source Integrators |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). |
|
|
|
# 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 |
|
|
|
|
|
|
@ -37,11 +37,8 @@ class SaleOrder(models.Model): |
|
|
|
'sale_line_id': line.id, |
|
|
|
'uom_id': line.product_uom.id |
|
|
|
}) |
|
|
|
# If the product sold has a BOM, create a service profile |
|
|
|
bom = self.env['mrp.bom'].search( |
|
|
|
[('product_tmpl_id', '=', |
|
|
|
line.product_id.product_tmpl_id.id)]) |
|
|
|
if bom: |
|
|
|
# If the product is a service profile, create one |
|
|
|
if line.product_id.product_tmpl_id.is_serviceprofile: |
|
|
|
self.env['agreement.serviceprofile'].create({ |
|
|
|
'name': line.name, |
|
|
|
'agreement_id': order.agreement_id.id, |
|
|
|
|
|
@ -1,10 +1,10 @@ |
|
|
|
<?xml version="1.0"?> |
|
|
|
<odoo> |
|
|
|
<!-- Copyright 2018 Open Source Integrators |
|
|
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
|
|
|
<!-- Copyright 2019 Open Source Integrators |
|
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|
|
|
|
|
|
|
<!-- Agreement Form View --> |
|
|
|
<record id="agreement_sale_form_view" model="ir.ui.view"> |
|
|
|
<record id="agreement_sale_form_view" model="ir.ui.view"> |
|
|
|
<field name="name">agreement.form.view</field> |
|
|
|
<field name="model">agreement</field> |
|
|
|
<field name="inherit_id" ref="agreement.partner_agreement_form_view"/> |
|
|
|
|
|
@ -0,0 +1,25 @@ |
|
|
|
<?xml version="1.0"?> |
|
|
|
<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> |
|
|
@ -1,10 +1,10 @@ |
|
|
|
<?xml version="1.0"?> |
|
|
|
<odoo> |
|
|
|
<!-- Copyright 2018 Open Source Integrators |
|
|
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
|
|
|
<!-- Copyright 2019 Open Source Integrators |
|
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|
|
|
|
|
|
|
<!-- Agreement Form View --> |
|
|
|
<record id="sale_order_agreement_form_view" model="ir.ui.view"> |
|
|
|
<record id="sale_order_agreement_form_view" model="ir.ui.view"> |
|
|
|
<field name="name">sale.order.agreement.form.view</field> |
|
|
|
<field name="model">sale.order</field> |
|
|
|
<field name="inherit_id" ref="sale.view_order_form"/> |
|
|
|