禁用OpenERP中特定功能的创建和放弃按钮 [英] Disable create and discard button for specific function in OpenERP
问题描述
我一直在为OpenERP 7开发模块.我想知道如何禁用特定功能的创建/删除按钮.就像我单击一个按钮以打开树形视图一样.我想要做的就是禁用该树视图顶部的创建"按钮窗体.如何在OpenERP中实现这一目标?我没有其他可以查看此树视图的ml的视图.我正在调用唯一的树视图.但是这次我不需要创建/放弃按钮.谁能指导我该怎么做? 我有一个名为"my_views"的按钮.我与此按钮一起使用的代码为:
I have been developing a module for OpenERP 7. I wanted to know that how can I disable create/delete button for a specific function. Like I am clicking on a button to open a tree view. All I want is to disable the create button form top of that tree view. How can I achieve this in OpenERP? I don't have any other ml view for this tree view. I am calling the only tree view. But this time I don't need the create/discard button. Can anyone guide me how to do this? I have a button named "my_views". The code I used with this button is as:
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)]
}
然后,我尝试在所需的模型树视图的xml中使用context.get:
Then I am trying to use context.get in the xml of my required tree view of model as:
<tree create="context.get('prod1',false)"
但我收到错误消息:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
推荐答案
尝试此操作,将create/delete设置为false,以便禁用顶部的按钮.
try this ,set create/delete as false so that button on top disable.
<tree string="my tree" create="false" delete='false'> </tree>
在此之后,您可以禁用该树视图顶部的创建/删除"按钮.
after this in this specific you can disable the create/delete button form top of that tree view.
这篇关于禁用OpenERP中特定功能的创建和放弃按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!