mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] product_contract: Migration to 17.0
This commit is contained in:
@@ -81,6 +81,8 @@ Contributors
|
||||
- Ernesto Tejeda
|
||||
- Pedro M. Baeza
|
||||
|
||||
- David Jaen <david.jaen.revert@gmail.com>
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
{
|
||||
"name": "Recurring - Product Contract",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"category": "Contract Management",
|
||||
"license": "AGPL-3",
|
||||
"author": "LasLabs, " "ACSONE SA/NV, " "Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/contract",
|
||||
"depends": ["product", "contract", "sale"],
|
||||
"data": [
|
||||
"views/res_config_settings.xml",
|
||||
"wizards/res_config_settings.xml",
|
||||
"views/contract.xml",
|
||||
"views/product_template.xml",
|
||||
"views/sale_order.xml",
|
||||
|
||||
@@ -57,7 +57,7 @@ class SaleOrder(models.Model):
|
||||
"payment_term_id": self.payment_term_id.id,
|
||||
"fiscal_position_id": self.fiscal_position_id.id,
|
||||
"invoice_partner_id": self.partner_invoice_id.id,
|
||||
"line_recurrence": self.partner_invoice_id.id,
|
||||
"line_recurrence": True,
|
||||
}
|
||||
|
||||
def action_create_contract(self):
|
||||
@@ -101,7 +101,7 @@ class SaleOrder(models.Model):
|
||||
contract = contract_model.create(
|
||||
rec._prepare_contract_value(contract_template)
|
||||
)
|
||||
contracts.append(contract)
|
||||
contracts.append(contract.id)
|
||||
contract._onchange_contract_template_id()
|
||||
contract._onchange_contract_type()
|
||||
order_lines.create_contract_line(contract)
|
||||
|
||||
@@ -266,7 +266,7 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
def invoice_line_create(self, invoice_id, qty):
|
||||
return super(
|
||||
SaleOrderLine, self.filtered(lambda l: not l.contract_id)
|
||||
SaleOrderLine, self.filtered(lambda line: not line.contract_id)
|
||||
).invoice_line_create(invoice_id, qty)
|
||||
|
||||
@api.depends("qty_invoiced", "qty_delivered", "product_uom_qty", "state")
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
- [Tecnativa](https://www.tecnativa.com):
|
||||
- Ernesto Tejeda
|
||||
- Pedro M. Baeza
|
||||
- David Jaen \<<david.jaen.revert@gmail.com>\>
|
||||
|
||||
@@ -426,6 +426,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Pedro M. Baeza</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>David Jaen <<a class="reference external" href="mailto:david.jaen.revert@gmail.com">david.jaen.revert@gmail.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
||||
@@ -63,7 +63,7 @@ class TestSaleOrder(TransactionCase):
|
||||
}
|
||||
)
|
||||
cls.order_line1 = cls.sale.order_line.filtered(
|
||||
lambda l: l.product_id == cls.product1
|
||||
lambda line: line.product_id == cls.product1
|
||||
)
|
||||
cls.order_line1.date_start = "2018-01-01"
|
||||
cls.order_line1.product_uom_qty = 12
|
||||
@@ -143,7 +143,9 @@ class TestSaleOrder(TransactionCase):
|
||||
self.assertEqual(self.order_line1.invoice_status, "no")
|
||||
invoice = self.order_line1.contract_id.recurring_create_invoice()
|
||||
self.assertTrue(invoice)
|
||||
self.assertEqual(self.order_line1.qty_invoiced, 1)
|
||||
self.assertEqual(
|
||||
self.order_line1.qty_invoiced, self.order_line1.product_uom_qty
|
||||
)
|
||||
self.assertEqual(self.order_line1.qty_to_invoice, 0)
|
||||
|
||||
def test_action_confirm_without_contract_creation(self):
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
name="action_view_sales_orders"
|
||||
type="object"
|
||||
icon="fa-edit"
|
||||
attrs="{'invisible': [('sale_order_count', '=', 0)]}"
|
||||
invisible="sale_order_count == 0"
|
||||
>
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="inherit_id" ref="product.product_template_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='options']" position="inside">
|
||||
<div attrs="{'invisible': [('type', '!=', 'service')],}">
|
||||
<div invisible="type != 'service'">
|
||||
<field name="is_contract" />
|
||||
<label for="is_contract" />
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
<page
|
||||
string="Contract"
|
||||
name="contract"
|
||||
attrs="{'invisible': [('is_contract', '=', False)],}"
|
||||
invisible="is_contract == False"
|
||||
>
|
||||
<group>
|
||||
<field name="property_contract_template_id" />
|
||||
@@ -38,37 +38,37 @@
|
||||
<field name="is_auto_renew" />
|
||||
</group>
|
||||
<group>
|
||||
<group attrs="{'invisible':[('is_auto_renew', '=', False)]}">
|
||||
<group invisible="is_auto_renew == False">
|
||||
<label for="auto_renew_interval" />
|
||||
<div>
|
||||
<field
|
||||
name="auto_renew_interval"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
<field
|
||||
name="auto_renew_rule_type"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
</div>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('is_auto_renew', '=', False)]}">
|
||||
<group invisible="is_auto_renew == False">
|
||||
<label for="termination_notice_interval" />
|
||||
<div>
|
||||
<field
|
||||
name="termination_notice_interval"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
<field
|
||||
name="termination_notice_rule_type"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
</div>
|
||||
</group>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2019 ACSONE SA/NV
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="res_config_settings_form_view">
|
||||
<field name="name">res.config.settings.form (in product_contract)
|
||||
</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
expr="//div[@id='sales_settings_invoicing_policy']/.."
|
||||
position="inside"
|
||||
>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="create_contract_at_sale_order_confirmation" />
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="create_contract_at_sale_order_confirmation" />
|
||||
<div class="text-muted">
|
||||
Automatically Create Contracts At Sale Order Confirmation
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -16,7 +16,7 @@
|
||||
string="Create Contracts"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible': [('need_contract_creation', '=', False)]}"
|
||||
invisible="need_contract_creation == False"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
@@ -25,7 +25,7 @@
|
||||
type="object"
|
||||
icon="fa-book"
|
||||
class="oe_stat_button"
|
||||
attrs="{'invisible': ['|', '|', ('is_contract', '!=', True), ('state', 'not in', ['sale', 'done']), ('contract_count', '=', 0)]}"
|
||||
insivible="is_contract != True or state not in ['sale', 'done'] or contract_count == 0"
|
||||
>
|
||||
<field string="Contracts" name="contract_count" widget="statinfo" />
|
||||
</button>
|
||||
@@ -41,13 +41,13 @@
|
||||
<field
|
||||
name="contract_id"
|
||||
options='{"no_create": True}'
|
||||
attrs="{'invisible': [('is_contract', '=', False)]}"
|
||||
invisible="is_contract == False"
|
||||
domain="['|',('contract_template_id','=',contract_template_id), ('contract_template_id','=',False), ('partner_id','=',parent.partner_id), ('is_terminated','=',False),
|
||||
]"
|
||||
/>
|
||||
<field
|
||||
name="contract_line_id"
|
||||
attrs="{'invisible': [('is_contract', '=', False)]}"
|
||||
invible="is_contract == False"
|
||||
domain="[('contract_id','=',contract_id)]"
|
||||
/>
|
||||
</xpath>
|
||||
@@ -59,43 +59,37 @@
|
||||
<separator
|
||||
colspan="4"
|
||||
string="Recurrence Invoicing"
|
||||
attrs="{'invisible': [('is_contract', '=', False)]}"
|
||||
invisible="is_contract == False"
|
||||
/>
|
||||
<group attrs="{'invisible': [('is_contract', '=', False)]}">
|
||||
<group invisible="is_contract == False">
|
||||
<field name="recurring_rule_type" />
|
||||
</group>
|
||||
<group attrs="{'invisible': [('is_contract', '=', False)]}">
|
||||
<group invisible="is_contract == False">
|
||||
<field name="recurring_invoicing_type" />
|
||||
</group>
|
||||
<group attrs="{'invisible': [('is_contract', '=', False)]}">
|
||||
<field
|
||||
name="date_start"
|
||||
attrs="{'required': [('is_contract', '=', True)]}"
|
||||
/>
|
||||
<group invisible="is_contract == False">
|
||||
<field name="date_start" required="is_contract == True" />
|
||||
</group>
|
||||
<group attrs="{'invisible': [('is_contract', '=', False)]}">
|
||||
<field
|
||||
name="date_end"
|
||||
attrs="{'required': [('is_contract', '=', True)]}"
|
||||
/>
|
||||
<group invisible="is_contract == False">
|
||||
<field name="date_end" required="is_contract == True" />
|
||||
</group>
|
||||
<group attrs="{'invisible': [('is_contract', '=', False)]}">
|
||||
<group invisible="is_contract == False">
|
||||
<field name="is_auto_renew" />
|
||||
</group>
|
||||
<group attrs="{'invisible': [('is_auto_renew', '=', False)]}">
|
||||
<group invisible="is_auto_renew == False">
|
||||
<label for="auto_renew_interval" />
|
||||
<div>
|
||||
<field
|
||||
name="auto_renew_interval"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
<field
|
||||
name="auto_renew_rule_type"
|
||||
class="oe_inline"
|
||||
nolabel="1"
|
||||
attrs="{'required':[('is_auto_renew', '=', True)]}"
|
||||
required="is_auto_renew == True"
|
||||
/>
|
||||
</div>
|
||||
</group>
|
||||
@@ -106,12 +100,9 @@
|
||||
>
|
||||
<field
|
||||
name="date_start"
|
||||
attrs="{'column_invisible': [('parent.is_contract', '=', False)]}"
|
||||
/>
|
||||
<field
|
||||
name="date_end"
|
||||
attrs="{'column_invisible': [('parent.is_contract', '=', False)]}"
|
||||
column_invisible="parent.is_contract == False"
|
||||
/>
|
||||
<field name="date_end" column_invisible="parent.is_contract == False" />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree" position="attributes">
|
||||
<attribute name="editable" />
|
||||
|
||||
24
product_contract/wizards/res_config_settings.xml
Normal file
24
product_contract/wizards/res_config_settings.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2019 ACSONE SA/NV
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="res_config_settings_form_view">
|
||||
<field name="name">res.config.settings.form (in product_contract)
|
||||
</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
expr="//block[@name='invoicing_setting_container']"
|
||||
position="inside"
|
||||
>
|
||||
<setting
|
||||
id="create_contract_at_sale_order_confirmation"
|
||||
title="Automatically Create Contracts At Sale Order Confirmation"
|
||||
>
|
||||
<field name="create_contract_at_sale_order_confirmation" />
|
||||
</setting>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user