禁用OpenERP中特定功能的“创建和放弃”按钮

2024-05-16 20:33:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在为OpenerP7开发一个模块。我想知道如何为一个特定的函数禁用create/delete按钮。就像我点击一个按钮打开一个树状视图。我只想禁用树视图顶部的create按钮。如何在OpenERP中实现这一点?对于这个树视图,我没有任何其他ml视图。我称之为唯一的树视图。但这次我不需要create/discard按钮。有人能指导我怎么做吗? 我有一个名为“我的观点”的按钮。我用这个按钮的代码是:

context['prod1']='false'
        ctx = dict(context)
        print ctx['prod1']

        return {
           'type': 'ir.actions.act_window',
           'res_model': 'product.product',
           'view_type': 'form',
           'view_mode': 'tree,form',
           'target': 'current',
           'context':ctx,  
           'create':False,   
           'domain':[('id','in',domain)]
               } 

然后我试着用上下文.get在我所需模型树状图的xml中:

^{pr2}$

但我得到了错误:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Tags: 模块formview视图jsondomaintypecreate