[FIX] product: unfuck templates and products in views
product.product reuses most of the product.template views however some parts need to be excluded or replaced. Instead of adding template only parts in base view and removing it for product, split the views in 'common' (product_template_form_view), 'template only' (product_template_only_form_view) and 'product only' (product_normal_form_view) where the first is inherited by the other two. The attribute mode='primary' on both second views allows to make sure that future inheritance of product_template_form_view and product_template_only_form_view will work with the full rendered product_template_form_view view. This allows us to have valid buttons in crm for bill of material (filters based on active_id). Also cleaning the mess with circular dependencies.
This commit is contained in:
+25
-4
@@ -422,7 +422,8 @@
|
|||||||
<search string="Search Bill Of Material">
|
<search string="Search Bill Of Material">
|
||||||
<field name="name" string="Bill Of Material" filter_domain="['|',('name','ilike',self),('code','ilike',self)]"/>
|
<field name="name" string="Bill Of Material" filter_domain="['|',('name','ilike',self),('code','ilike',self)]"/>
|
||||||
<field name="bom_line_ids" string="Components"/>
|
<field name="bom_line_ids" string="Components"/>
|
||||||
<field name="product_tmpl_id"/>
|
<field name="product_tmpl_id" string="Product"/>
|
||||||
|
<field name="product_id" string="Variant"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<group expand="0" string="Group By...">
|
<group expand="0" string="Group By...">
|
||||||
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_tmpl_id'}"/>
|
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_tmpl_id'}"/>
|
||||||
@@ -1032,12 +1033,19 @@
|
|||||||
id="menu_mrp_production_order_action" name="Order Planning"
|
id="menu_mrp_production_order_action" name="Order Planning"
|
||||||
parent="menu_mrp_planning" sequence="1"/>
|
parent="menu_mrp_planning" sequence="1"/>
|
||||||
|
|
||||||
<record model="ir.actions.act_window" id="product_open_bom">
|
<record model="ir.actions.act_window" id="template_open_bom">
|
||||||
<field name="context">{'default_product_tmpl_id': active_id, 'search_default_product_tmpl_id': active_id}</field>
|
<field name="context">{'default_product_tmpl_id': active_id, 'search_default_product_tmpl_id': active_id}</field>
|
||||||
<field name="name">Bill of Materials</field>
|
<field name="name">Bill of Materials</field>
|
||||||
<field name="res_model">mrp.bom</field>
|
<field name="res_model">mrp.bom</field>
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.actions.act_window" id="product_open_bom">
|
||||||
|
<field name="context">{'default_product_id': active_id, 'search_default_product_id': active_id}</field>
|
||||||
|
<field name="name">Bill of Materials</field>
|
||||||
|
<field name="res_model">mrp.bom</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="act_product_mrp_production" model="ir.actions.act_window">
|
<record id="act_product_mrp_production" model="ir.actions.act_window">
|
||||||
<field name="context">{'search_default_product_id': [active_id]}</field>
|
<field name="context">{'search_default_product_id': [active_id]}</field>
|
||||||
<field name="name">Manufacturing Orders</field>
|
<field name="name">Manufacturing Orders</field>
|
||||||
@@ -1047,10 +1055,23 @@
|
|||||||
<record model="ir.ui.view" id="product_template_form_view_bom_button">
|
<record model="ir.ui.view" id="product_template_form_view_bom_button">
|
||||||
<field name="name">product.template.procurement</field>
|
<field name="name">product.template.procurement</field>
|
||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<div name="buttons" position="inside">
|
<div name="buttons" position="inside">
|
||||||
<button class="oe_inline oe_stat_button" name="%(product_open_bom)d" type="action"
|
<button class="oe_inline oe_stat_button" name="%(template_open_bom)d" type="action"
|
||||||
|
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-flask">
|
||||||
|
<field string="Bill of Materials" name="bom_count" widget="statinfo" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="product_product_form_view_bom_button">
|
||||||
|
<field name="name">product.product.procurement</field>
|
||||||
|
<field name="model">product.product</field>
|
||||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="buttons" position="inside">
|
||||||
|
<button class="oe_inline oe_stat_button" name="%(product_open_bom)d" type="action"
|
||||||
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-flask">
|
groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-flask">
|
||||||
<field string="Bill of Materials" name="bom_count" widget="statinfo" />
|
<field string="Bill of Materials" name="bom_count" widget="statinfo" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
+118
-130
@@ -40,8 +40,9 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- base structure of product.template, common with product.product -->
|
||||||
<record id="product_template_form_view" model="ir.ui.view">
|
<record id="product_template_form_view" model="ir.ui.view">
|
||||||
<field name="name">product.template.product.form</field>
|
<field name="name">product.template.common.form</field>
|
||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Product">
|
<form string="Product">
|
||||||
@@ -128,14 +129,6 @@
|
|||||||
<separator string="Description for Quotations"/>
|
<separator string="Description for Quotations"/>
|
||||||
<field name="description_sale" placeholder="note to be displayed on quotations..."/>
|
<field name="description_sale" placeholder="note to be displayed on quotations..."/>
|
||||||
</page>
|
</page>
|
||||||
<page name="variants" string="Variants">
|
|
||||||
<field name="attribute_line_ids" widget="one2many_list">
|
|
||||||
<tree string="Variants" editable="bottom">
|
|
||||||
<field name="attribute_id"/>
|
|
||||||
<field name="value_ids" widget="many2many_tags" domain="[('attribute_id', '=', attribute_id)]" context="{'default_attribute_id': attribute_id}"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</page>
|
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
<div class="oe_chatter">
|
<div class="oe_chatter">
|
||||||
@@ -146,6 +139,116 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="product_search_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.product.search</field>
|
||||||
|
<field name="model">product.product</field>
|
||||||
|
<field name="mode">primary</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="name" position="replace">
|
||||||
|
<field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>
|
||||||
|
</field>
|
||||||
|
<field name="product_variant_ids" position="replace">
|
||||||
|
<field name="attribute_value_ids"/>
|
||||||
|
</field>
|
||||||
|
<field name="name" position="after">
|
||||||
|
<field name="product_tmpl_id" string="Product Template"/>
|
||||||
|
</field>
|
||||||
|
<xpath expr="//group[@string='Group by...']" position="inside">
|
||||||
|
<filter string='Product Template' name="template_id" domain="[]" context="{'group_by' : 'product_tmpl_id'}"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- variants -->
|
||||||
|
|
||||||
|
<record id="variants_template_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">variants.template.tree</field>
|
||||||
|
<field name="model">product.attribute.value</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Variant Values" editable="top">
|
||||||
|
<field name="sequence" widget="handle"/>
|
||||||
|
<field name="attribute_id"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="price_extra"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="variants_template_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Variant Values</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">product.attribute.value</field>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="domain">[('product_ids.product_tmpl_id', '=', active_id)]</field>
|
||||||
|
<field name="context">{'default_product_tmpl_id': active_id}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="product_normal_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Product Variants</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">product.product</field>
|
||||||
|
<field name="view_mode">tree,form,kanban</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="search_view_id" ref="product_search_form_view"/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
Click to define a new product.
|
||||||
|
</p><p>
|
||||||
|
You must define a product for everything you buy or sell,
|
||||||
|
whether it's a physical product, a consumable or service.
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="product_variant_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Product Variants</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">product.product</field>
|
||||||
|
<field name="view_mode">tree,form,kanban</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="context">{'search_default_product_tmpl_id': [active_id], 'default_product_tmpl_id': active_id}</field>
|
||||||
|
<field name="search_view_id" ref="product_search_form_view"/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
Click to define a new product.
|
||||||
|
</p><p>
|
||||||
|
You must define a product for everything you buy or sell,
|
||||||
|
whether it's a physical product, a consumable or service.
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- view specific to product.template -->
|
||||||
|
<record id="product_template_only_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.product.form</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="mode">primary</field>
|
||||||
|
<field name="priority" eval="8" />
|
||||||
|
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//form" position="attributes">
|
||||||
|
<attribute name="name">Product Template</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//page[@string='Sales']" position="after">
|
||||||
|
<page name="variants" string="Variants">
|
||||||
|
<div class="oe_right">
|
||||||
|
<button class="oe_inline oe_stat_button" string="Variant Prices" name="%(variants_template_action)d" type="action" icon="fa-strikethrough"/>
|
||||||
|
<button class="oe_inline oe_stat_button" name="%(product.product_variant_action)d" type="action" icon="fa-sitemap">
|
||||||
|
<field string="Variants" name="product_variant_count" widget="statinfo" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<field name="attribute_line_ids" widget="one2many_list">
|
||||||
|
<tree string="Variants" editable="bottom">
|
||||||
|
<field name="attribute_id"/>
|
||||||
|
<field name="value_ids" widget="many2many_tags" domain="[('attribute_id', '=', attribute_id)]" context="{'default_attribute_id': attribute_id}"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="product_template_kanban_view" model="ir.ui.view">
|
<record id="product_template_kanban_view" model="ir.ui.view">
|
||||||
<field name="name">Product.template.product.kanban</field>
|
<field name="name">Product.template.product.kanban</field>
|
||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
@@ -153,6 +256,9 @@
|
|||||||
<kanban>
|
<kanban>
|
||||||
<field name="image_small"/>
|
<field name="image_small"/>
|
||||||
<field name="lst_price"/>
|
<field name="lst_price"/>
|
||||||
|
<field name="is_product_variant"/>
|
||||||
|
<field name="product_variant_count"/>
|
||||||
|
<field name="product_variant_ids"/>
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-box">
|
<t t-name="kanban-box">
|
||||||
<div class="oe_kanban_vignette oe_semantic_html_override">
|
<div class="oe_kanban_vignette oe_semantic_html_override">
|
||||||
@@ -163,6 +269,9 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
<a name="%(product.product_variant_action)d" type="action">
|
||||||
|
<t t-esc="record.product_variant_count.value"/> Variants
|
||||||
|
</a>
|
||||||
<div name="tags"/>
|
<div name="tags"/>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Price: <field name="lst_price"></field></li>
|
<li>Price: <field name="lst_price"></field></li>
|
||||||
@@ -188,56 +297,10 @@
|
|||||||
id="menu_product_template_action"
|
id="menu_product_template_action"
|
||||||
parent="base.menu_product" sequence="1" />
|
parent="base.menu_product" sequence="1" />
|
||||||
|
|
||||||
<!-- variants -->
|
|
||||||
|
|
||||||
<record id="variants_template_tree_view" model="ir.ui.view">
|
|
||||||
<field name="name">variants.template.tree</field>
|
|
||||||
<field name="model">product.attribute.value</field>
|
|
||||||
<field name="priority" eval="2"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree string="Variant Values" editable="top">
|
|
||||||
<field name="sequence" widget="handle"/>
|
|
||||||
<field name="attribute_id"/>
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="price_extra"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
<record id="variants_template_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Variant Values</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">product.attribute.value</field>
|
|
||||||
<field name="view_mode">tree</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="domain">[('product_ids.product_tmpl_id', '=', active_id)]</field>
|
|
||||||
<field name="context">{'default_product_tmpl_id': active_id}</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- product product -->
|
<!-- product product -->
|
||||||
|
|
||||||
<menuitem id="prod_config_main" name="Product Categories & Attributes" parent="base.menu_base_config" sequence="70" groups="base.group_no_one"/>
|
<menuitem id="prod_config_main" name="Product Categories & Attributes" parent="base.menu_base_config" sequence="70" groups="base.group_no_one"/>
|
||||||
|
|
||||||
<record id="product_search_form_view" model="ir.ui.view">
|
|
||||||
<field name="name">product.product.search</field>
|
|
||||||
<field name="model">product.product</field>
|
|
||||||
<field name="mode">primary</field>
|
|
||||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="name" position="replace">
|
|
||||||
<field name="name" string="Product" filter_domain="['|',('default_code','ilike',self),('name','ilike',self)]"/>
|
|
||||||
</field>
|
|
||||||
<field name="product_variant_ids" position="replace">
|
|
||||||
<field name="attribute_value_ids"/>
|
|
||||||
</field>
|
|
||||||
<field name="name" position="after">
|
|
||||||
<field name="product_tmpl_id" string="Product Template"/>
|
|
||||||
</field>
|
|
||||||
<xpath expr="//group[@string='Group by...']" position="inside">
|
|
||||||
<filter string='Product Template' name="template_id" domain="[]" context="{'group_by' : 'product_tmpl_id'}"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_product_tree_view" model="ir.ui.view">
|
<record id="product_product_tree_view" model="ir.ui.view">
|
||||||
<field name="name">product.product.tree</field>
|
<field name="name">product.product.tree</field>
|
||||||
<field name="model">product.product</field>
|
<field name="model">product.product</field>
|
||||||
@@ -279,8 +342,6 @@
|
|||||||
<xpath expr="//div[@class='oe_title']" position="inside">
|
<xpath expr="//div[@class='oe_title']" position="inside">
|
||||||
<field name="attribute_value_ids" widget="many2many_tags"/>
|
<field name="attribute_value_ids" widget="many2many_tags"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<page name="variants" position="replace">
|
|
||||||
</page>
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -316,79 +377,6 @@
|
|||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
||||||
<record id="product_normal_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Product Variants</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">product.product</field>
|
|
||||||
<field name="view_mode">tree,form,kanban</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="search_view_id" ref="product_search_form_view"/>
|
|
||||||
<field name="help" type="html">
|
|
||||||
<p class="oe_view_nocontent_create">
|
|
||||||
Click to define a new product.
|
|
||||||
</p><p>
|
|
||||||
You must define a product for everything you buy or sell,
|
|
||||||
whether it's a physical product, a consumable or service.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<record id="product_variant_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Product Variants</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">product.product</field>
|
|
||||||
<field name="view_mode">tree,form,kanban</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="context">{'search_default_product_tmpl_id': [active_id], 'default_product_tmpl_id': active_id}</field>
|
|
||||||
<field name="search_view_id" ref="product_search_form_view"/>
|
|
||||||
<field name="help" type="html">
|
|
||||||
<p class="oe_view_nocontent_create">
|
|
||||||
Click to define a new product.
|
|
||||||
</p><p>
|
|
||||||
You must define a product for everything you buy or sell,
|
|
||||||
whether it's a physical product, a consumable or service.
|
|
||||||
</p>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_form_view_variant_button" model="ir.ui.view">
|
|
||||||
<field name="name">product.template.form</field>
|
|
||||||
<field name="model">product.template</field>
|
|
||||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="attribute_line_ids" position="before">
|
|
||||||
<div class="oe_right">
|
|
||||||
<button class="oe_inline oe_stat_button" string="Variant Prices" name="%(product.variants_template_action)d" type="action" icon="fa-strikethrough"/>
|
|
||||||
<button class="oe_inline oe_stat_button" name="%(product.product_variant_action)d" type="action" icon="fa-sitemap">
|
|
||||||
<field string="Variants" name="product_variant_count" widget="statinfo" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="product_template_kanban_view_variant_button" model="ir.ui.view">
|
|
||||||
<field name="name">product.template.form</field>
|
|
||||||
<field name="model">product.template</field>
|
|
||||||
<field name="inherit_id" ref="product.product_template_kanban_view"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="lst_price" position="after">
|
|
||||||
<field name="is_product_variant"/>
|
|
||||||
<field name="product_variant_count"/>
|
|
||||||
<field name="product_variant_ids"/>
|
|
||||||
</field>
|
|
||||||
<h4 position="after">
|
|
||||||
<a name="%(product.product_variant_action)d" type="action">
|
|
||||||
<t t-esc="record.product_variant_count.value"/> Variants
|
|
||||||
</a>
|
|
||||||
</h4>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<record id="attribute_tree_view" model="ir.ui.view">
|
<record id="attribute_tree_view" model="ir.ui.view">
|
||||||
<field name="name">product.attribute.tree</field>
|
<field name="name">product.attribute.tree</field>
|
||||||
<field name="model">product.attribute</field>
|
<field name="model">product.attribute</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user