Skip to Content
Menu
This question has been flagged
3 Replies
4607 Zobrazenia

Hey,

when typing something in to a many2one field it quickly happens that a user types something in and hits enter and therefore creates a new record on the many2one field.

Therefore I would like to disable this feature and some how restrict this that he can only add new entries by either switching to debug mode or changing to a special view where he can hit a create button first.


Hope you can help me how to achieve this.

Thanks in advance!


Avatar
Zrušiť
Best Answer

Hi,

If you want to disable the create and edit option from the Many2one field, you can update your field by adding options to it.

<field name="many2onefield" options="{'no_create': True, 'no_create_edit':True}" />


By activating the developer mode and clicking the Edit form view from the debugger button, you can spot your field in the view, along with your field definition add this,


options="{'no_create': True, 'no_create_edit':True}" 


For editing the field from the UI, see this: How To Add custom field from UI

For making the change from code by inheriting : Make Changes in Exiting Views


Thanks

Avatar
Zrušiť
Best Answer

If I understand correctly you are trying to hide the Create & Edit button. 

If so, have you looked at this technique? 

\Odoo forum: Hide [ Create and Edit... ] button

It suggests that you set the create and edit attributes to false, like so :

<form string="NAMEOFFORM" create="false" edit="false">

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
apr 15
3995
3
apr 23
34398
0
dec 21
2149
3
sep 19
7288
0
feb 19
2485