[IMP] product,purchase: Hide the variant in supplier tree view if no variant

Purpose
=======

Issue: Product_id field should be visible only when product has more than one variant

Here's how it can be reproduced,

Assign user with group group_product_variant
Create a product without any variant

In this case, the product_id field won't be shown in product.template's internal form view for product.supplierinfo, that's working fine. But, now, as this fix is reverted, the product_id field will be visible in product.template's internal tree view for product.supplierinfo.
This commit is contained in:
Yannick Tivisse
2017-08-10 10:52:22 +02:00
parent 3d3a23c919
commit d17ef562a9
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -558,7 +558,7 @@
<tree string="Vendor Information">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="product_id" groups="product.group_product_variant"/>
<field name="product_id" invisible="context.get('product_template_invisible_variant', False)"/>
<field name="product_tmpl_id" string="Product" invisible="context.get('visible_product_tmpl_id', True)"/>
<field name="min_qty"/>
<field name="price" string="Price"/>
+2 -2
View File
@@ -558,10 +558,10 @@
<page name="sales" position="after">
<page string="Purchase" name="purchase" attrs="{'invisible': [('purchase_ok','=',False)]}">
<group string="Vendors" name="vendors" attrs="{'invisible': [('product_variant_count','&gt;',1)]}">
<field name="seller_ids" context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id)}" nolabel="1"/>
<field name="seller_ids" context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id), 'product_template_invisible_variant': True}" nolabel="1"/>
</group>
<group string="Vendors" name="variant_vendors" attrs="{'invisible': [('product_variant_count','&lt;=',1)]}">
<field name="variant_seller_ids" context="{'default_product_tmpl_id': context.get('product_tmpl_id', active_id)}, 'tree_view_ref': 'product.product_supplierinfo_tree_view'" nolabel="1"/>
<field name="variant_seller_ids" context="{'default_product_tmpl_id': context.get('product_tmpl_id', active_id)}" nolabel="1"/>
</group>
</page>
</page>