简体   繁体   English

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

[英]Disable create and discard button for specific function in OpenERP

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. 我一直在为OpenERP 7开发模块。我想知道如何禁用特定功能的创建/删除按钮。 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? 如何在OpenERP中实现这一目标? I don't have any other ml view for this tree view. 我对此树视图没有任何其他ml视图。 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". 我有一个名为“ 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)]
               } 

Then I am trying to use context.get in the xml of my required tree view of model as: 然后,我尝试在所需的模型树视图的xml中使用context.get作为:

<tree create="context.get('prod1',false)"

but I am getting error: 但我得到错误:

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

try this ,set create/delete as false so that button on top disable. 尝试此操作,将create / delete设置为false,以禁用顶部的按钮。

<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. 在此之后,您可以禁用该树视图顶部的“创建/删除”按钮窗体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM