This question has been flagged

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