Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3 Risposte
4645 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
apr 15
4020
3
apr 23
34438
0
dic 21
2204
3
set 19
7344
0
feb 19
2500