通过OpenERP-7中的按钮调用树形视图 [英] Tree view to be called through button in OpenERP-7

查看:61
本文介绍了通过OpenERP-7中的按钮调用树形视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何通过按钮调用树视图(不同记录的视图).因为返回表单视图很容易,但是当我尝试对树形视图执行准确的操作时,它仅显示一个列表.

I wanted to know that how may I call the tree view(of different records) through a button . Because returning form view is easy but when I tried to do exact thing for tree view it shows a list only.

这种情况是我有一个搜索产品表格.现在,当生成搜索时,将在该字段中填充一个记录域.

The scenario is that I have a search product form. Now when the search is generated,a domain of records is filled in the field.

我想添加一个按钮来调用树视图,该树视图向我显示了该域中存在的记录.我向按钮添加了一个功能,但它向我显示了列表中的所有记录,甚至没有仅显示域中的记录.

I want to add a button to call the tree view showing me the records present in that domain. I added a function to button but it showed me all the record in a list , didnot even show only the records in the domain.

我试图通过单击按钮来调用以下函数,但它不满足我的需求:

I have tried to call the following function through a button-click but it did not meet my needs:

def views(self,cr,uid,ids,context=None):
    for id in ids:
        deg_obj=self.pool.get('deg.form').browse(cr,uid,id)
        my_id=int(deg_obj.my_products)
    return{
          'view_type': 'tree',
          'view_mode': 'tree',
          'res_model': 'product.product',
          'res_id':my_id,
          'context': context,
          'type': 'ir.actions.act_window',
          'readonly':True,
          }

我需要一些指导来标记我的错误.感谢所有人

I need some guidance on this to mark my mistake. Thanks to all

推荐答案

我通过对我的python代码进行了以下更改已解决了该问题.

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

这篇关于通过OpenERP-7中的按钮调用树形视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆