[IMP]product template: put context 'search_variants' in action to hide a blank varinats and revert the revno 10025.

bzr revid: dka@tinyerp.com-20140115122723-we4y9wmn6pu36rh9
This commit is contained in:
Darshan Kalola (OpenERP) 2014-01-15 17:57:23 +05:30
parent 33af9858b5
commit d4460bf323
2 changed files with 9 additions and 4 deletions

View File

@ -690,7 +690,7 @@ class product_product(osv.osv):
'default_code' : fields.char('Internal Reference', size=64, select=True),
'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the product without removing it."),
'variants': fields.char('Variants', size=64, translate=True),
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="restrict", select=True),
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True),
'ean13': fields.char('EAN13 Barcode', size=13, help="International Article Number used for product identification."),
'packaging' : fields.one2many('product.packaging', 'product_id', 'Logistical Units', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."),
'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Product Price'), help="Price Extra: Extra price for the variant on sale price. eg. 200 price extra, 1000 + 200 = 1200."),
@ -936,8 +936,12 @@ class product_product(osv.osv):
context=context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context and context.get('search_default_categ_id'):
if context is None:
context = {}
if context.get('search_default_categ_id'):
args.append((('categ_id', 'child_of', context['search_default_categ_id'])))
if context.get('search_variants'):
args.append(('variants', '!=', ''))
return super(product_product, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)

View File

@ -849,9 +849,9 @@
</group>
</group>
<group colspan="4" string="Product Variants">
<field colspan="4" name="product_variant_ids" nolabel="1" domain="[('variants','!=',False)]">
<field colspan="4" name="product_variant_ids" nolabel="1" >
<tree string="Product Variants" editable="bottom">
<field name="variants"/>
<field name="variants" required="1"/>
<field name="price_margin" string="Variant Price Margin(%%)"/>
<field name="price_extra"/>
<field name="lst_price" string="Sale Price"/>
@ -956,6 +956,7 @@
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="context">{'search_variants': 1}</field>
<field name="view_id" ref="product_template_kanban_view"/>
</record>