Tree view to be called through button in OpenERP-7

荒凉一梦 提交于 2019-12-06 07:56:21

I have fixed the issue with following changes to my python code.

def views(self,cr,uid,ids,context):
     for id in ids:
         deg_obj=self.pool.get('deg.form').browse(cr,uid,id)
         my_id=int(deg_obj.my_products)
     ss= int(deg_obj.categ_temp2)   
     domain = [('categ_id','=',ss)]
     return {
         'type': 'ir.actions.act_window',
         'name': _('Product'),
         'res_model': 'product.product',
         'view_type': 'form',
         'view_mode': 'tree,form',
         'target': 'current',
         'domain': domain,
               }

Now its working ok. Thanks all

try this,

def views(self,cr,uid,ids,context=None):
    view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'product_product_tree_view')
    view_id = view_ref and view_ref[1] or False

    for id in ids:
        deg_obj=self.pool.get('deg.form').browse(cr,uid,id)
        my_id=int(deg_obj.my_products)

    #this will return product tree view and form view. 
    return {
       'type': 'ir.actions.act_window',
       'name': _('Product'),
       'res_model': 'product.product',
       'view_type': 'form',
       #'res_id': my_id, # this will open particular product,
       'view_id': view_id,
       'view_mode': 'tree',
       'target': 'current',
       'nodestroy': True,
   }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!