[IMP]rename has_variants field to standard_variants in product form and improved fields_view_get method.

bzr revid: dka@tinyerp.com-20140116074535-m40q8q7dy3kzfguf
This commit is contained in:
Darshan Kalola (OpenERP)
2014-01-16 13:15:35 +05:30
parent a8fe8ac44f
commit acde6d86c1
2 changed files with 13 additions and 8 deletions
+12 -7
View 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
+1 -1
View 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"/>