Arsalan Sherwani
Arsalan Sherwani

Reputation: 560

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. 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

Upvotes: 0

Views: 3081

Answers (1)

BBBagadiya
BBBagadiya

Reputation: 321

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.

Upvotes: 1

Related Questions