[FIX] stock: display variant fields on variant form
The structure of the product.{product,template} form is the following:
product.product_template_form_view* (both)
|-- product.product_template_only_form_view* (template)
| \-- stock.product_template_form_view_procurement_button
|
|-- product.product_normal_form_view* (product)
| \-- stock.product_form_view_procurement_button
|
\-- stock.view_template_property_form (both)
Previous view was adding weight, volume fields on both view with a attrs that
applies only to the product.template (display only if no template).
This means that the weight was not displayed on product.product form if opened
from a Many2one (using the default product.product view) while the attrs should
not hide it.
Closes #16541
Fixes #16428
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- view common to both template and product -->
|
||||
<record id="view_template_property_form" model="ir.ui.view">
|
||||
<field name="name">product.template.stock.property.form.inherit</field>
|
||||
<field name="model">product.template</field>
|
||||
@@ -131,13 +132,13 @@
|
||||
<field name="route_from_categ_ids" widget="many2many_tags" readonly="1" attrs="{'invisible':[('route_from_categ_ids', '=', [])]}"/>
|
||||
</group>
|
||||
<group name="group_lots_and_weight">
|
||||
<label for="weight" attrs="{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}"/>
|
||||
<div class="o_row" name="weight" attrs="{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}">
|
||||
<label for="weight" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"/>
|
||||
<div class="o_row" name="weight" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}">
|
||||
<field name="weight"/>
|
||||
</div>
|
||||
<field name="tracking" widget="radio" attrs="{'invisible':[('type', 'in', ['service', 'digital'])]}" groups="stock.group_production_lot"/>
|
||||
<label for="volume" attrs="{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}"/>
|
||||
<div class="o_row" name="volume" attrs="{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}">
|
||||
<label for="volume" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"/>
|
||||
<div class="o_row" name="volume" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}">
|
||||
<field name="volume" string="Volume"/>
|
||||
</div>
|
||||
</group>
|
||||
@@ -259,6 +260,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- view used for product.product only -->
|
||||
<record model="ir.ui.view" id="product_form_view_procurement_button">
|
||||
<field name="name">product.product.procurement</field>
|
||||
<field name="model">product.product</field>
|
||||
@@ -329,6 +331,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- view used for product.template only -->
|
||||
<record model="ir.ui.view" id="product_template_form_view_procurement_button">
|
||||
<field name="name">product.template_procurement</field>
|
||||
<field name="model">product.template</field>
|
||||
@@ -390,6 +393,22 @@
|
||||
class="oe_stat_button" icon="fa-cogs"
|
||||
groups="stock.group_adv_location"/>
|
||||
</div>
|
||||
|
||||
<!-- change attrs of fields added in view_template_property_form
|
||||
to restrict the display for templates -->
|
||||
<xpath expr="//label[@for='weight']" position="attributes">
|
||||
<attribute name="attrs">{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='weight']" position="attributes">
|
||||
<attribute name="attrs">{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='volume']" position="attributes">
|
||||
<attribute name="attrs">{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='volume']" position="attributes">
|
||||
<attribute name="attrs">{'invisible':['|', ('type', 'not in', ['product', 'consu']), ('product_variant_count', '>', 1)]}</attribute>
|
||||
</xpath>
|
||||
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user