[IMP]rename has_variants field to standard_variants in product form and improved...
authorDarshan Kalola (OpenERP) <dka@tinyerp.com>
Thu, 16 Jan 2014 07:45:35 +0000 (13:15 +0530)
committerDarshan Kalola (OpenERP) <dka@tinyerp.com>
Thu, 16 Jan 2014 07:45:35 +0000 (13:15 +0530)
bzr revid: dka@tinyerp.com-20140116074535-m40q8q7dy3kzfguf

addons/product/product.py
addons/product/product_view.xml

index aa9f93e..f8c676f 100644 (file)
@@ -749,14 +749,19 @@ class product_product(osv.osv):
             context = {}
         res = super(product_product, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
         #check the current user in group_product_variant
-        if self.pool['res.users'].has_group(cr, uid, 'product.group_product_variant') and view_type == 'form':
+        if view_type == 'form':
             doc = etree.XML(res['arch'])
-            for node in doc.xpath("//field[@name='name']"):
-                node.set('invisible', '1')
-                node.set('required', '0')
-                setup_modifiers(node, res['fields']['name'])
-            for node in doc.xpath("//label[@name='label_name']"):
-                node.set('string','Product Template')
+            if self.pool['res.users'].has_group(cr, uid, 'product.group_product_variant'):
+                for node in doc.xpath("//field[@name='name']"):
+                    node.set('invisible', '1')
+                    node.set('required', '0')
+                    setup_modifiers(node, res['fields']['name'])
+                for node in doc.xpath("//label[@name='label_name']"):
+                    node.set('string','Product Template')
+            else:
+                for node in doc.xpath("//field[@name='product_tmpl_id']"):
+                    node.set('required', '0')
+                    setup_modifiers(node, res['fields']['name'])
             res['arch'] = etree.tostring(doc)
         return res
 
index c98125e..2301df6 100644 (file)
@@ -61,7 +61,7 @@
                 <form string="Product" version="7.0">
                     <sheet>
                         <field name="image_medium" widget="image" class="oe_avatar oe_left"/>
-                        <field name="has_variants" invisible="1"/>
+                        <field name="standard_variants" invisible="1"/>
                         <field name="lst_price" invisible="1"/>
                         <field name="price_extra" invisible="1"/>
                         <field name="price_margin" invisible="1"/>