Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
4641 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
0
Apr 15
4016
3
Apr 23
34434
0
Des 21
2193
3
Sep 19
7331
0
Feb 19
2499