Disable create and discard button for specific function in OpenERP

跟風遠走 提交于 2019-12-24 11:27:51

问题


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)]
               } 

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)"

but I am getting error:

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

回答1:


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.



来源:https://stackoverflow.com/questions/25376304/disable-create-and-discard-button-for-specific-function-in-openerp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!