[IMP] sale(_*): merge product views

No need to have 3 views inheriting the same base 
`product.product_template_form_view`
This commit is contained in:
Victor Feyens
2022-01-03 12:22:48 +01:00
parent 063ad1834e
commit 29febb9980
3 changed files with 25 additions and 43 deletions
+23 -41
View File
@@ -1,15 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- TODO VFE remove useless view (same change done in view below) -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.product.website.form</field>
<field name="name">product.template.form.view.inherit.sale</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page name="sales" position="attributes">
<attribute name="invisible">0</attribute>
</page>
<field name="product_variant_count" position="after">
<field name="service_type" widget="radio" invisible="True"/>
<field name="visible_expense_policy" invisible="1"/>
</field>
<field name="detailed_type" position="after">
<field name="invoice_policy" required="1"/>
<field name="expense_policy" widget="radio" attrs="{'invisible': [('visible_expense_policy', '=', False)]}"/>
</field>
<field name="product_tooltip" position="after">
<label for="product_tooltip" string=""
attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}"/>
<div attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}"
class="font-italic text-muted">
You can invoice them before they are delivered.
</div>
<label for="product_tooltip" string=""
attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'delivery')]}"/>
<div attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'delivery')]}"
class="font-italic text-muted">
Invoice after delivery, based on quantities delivered, not ordered.
</div>
</field>
</field>
</record>
@@ -79,45 +100,6 @@
</field>
</record>
<!-- TODO VFE merge both views -->
<record model="ir.ui.view" id="product_template_form_view_invoice_policy">
<field name="name">product.template.invoice.policy</field>
<field name="model">product.template</field>
<field name="priority">15</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="product_variant_count" position="after">
<field name="service_type" widget="radio" invisible="True"/>
<field name="visible_expense_policy" invisible="1"/>
</field>
<field name="detailed_type" position="after">
<field name="invoice_policy" required="1"/>
<field name="expense_policy" widget="radio" attrs="{'invisible': [('visible_expense_policy', '=', False)]}"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="product_template_sale_form_view">
<field name="name">product.template.sales</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<group name="sale" position="attributes">
<attribute name="invisible">0</attribute>
</group>
<field name="product_tooltip" position="after">
<label for="product_tooltip" string="" attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}"/>
<div attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'order')]}" class="font-italic text-muted">
You can invoice them before they are delivered.
</div>
<label for="product_tooltip" string="" attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'delivery')]}"/>
<div attrs="{'invisible': ['|', ('type', 'not in', ('product', 'consu')), ('invoice_policy', '!=', 'delivery')]}" class="font-italic text-muted">
Invoice after delivery, based on quantities delivered, not ordered.
</div>
</field>
</field>
</record>
<record id="product_template_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
+1 -1
View File
@@ -4,7 +4,7 @@
<record id="product_template_form_view_invoice_policy_inherit_sale_project" model="ir.ui.view">
<field name="name">product.template.inherit.sale.projectform</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sale.product_template_form_view_invoice_policy"/>
<field name="inherit_id" ref="sale.product_template_form_view"/>
<field name="arch" type="xml">
<field name="invoice_policy" position="after">
<field name="service_tracking" required="1" attrs="{'invisible': [('type', '!=', 'service')]}"/>
@@ -3,7 +3,7 @@
<record id="view_product_timesheet_form" model="ir.ui.view">
<field name="name">product.template.timesheet.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sale.product_template_form_view_invoice_policy"/>
<field name="inherit_id" ref="sale.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_policy']" position="attributes">
<attribute name="invisible">False</attribute>