Thursday, 15 May 2014

How to hide create and edit from many2one dropdown in openerp v7

Sometimes case might happen , like you dont want to let create new records from many2one field.
example - There is customer field in sale order form , and you dont want to let user create a new customer from there .
You want let everyone create customer , then it is importtant post for you.

Install a openerp module named "web_m2x_options"
module url - https://www.openerp.com/apps/7.0/web_m2x_options/

Now you can use several options for many2one -

limit- Number of displayed record in drop-down panel(limit)
example - <field name="partner_id" options="{'limit': 10, }" />

create - Whether to display the "Create..." entry in dropdown panel(depends if user have create rights)).
example - <field name="partner_id" options="{'create': False, }" />

create_edit - Whether to display "Create and Edit..." entry in dropdown panel(depends if user have create rights)
example - <field name="partner_id" options="{'create_edit': False }" />

no_open - if you want to hide many2one link (used to open form view for many2one)
example - <field name="partner_id" options="{"no_open": True }" />


you can use all options at once also

options="{'limit': 10, 'create': False, 'create_edit': False ,"no_open": True }"


Thanks
Sonu Chaudhary

2 comments:

  1. Oww.. Very impressive work. What's the 'limit': 10 for? Can you please explain?

    ReplyDelete
  2. Oh sorry, I got it why the 'limit': 10 is used for. Very well done.

    ReplyDelete