コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
4608 ビュー

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!


アバター
破棄
最善の回答

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

アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
0
4月 15
3995
3
4月 23
34398
0
12月 21
2149
3
9月 19
7288
0
2月 19
2485