İçereği Atla
Menü
This question has been flagged
3 Cevaplar
2183 Görünümler

Good evening everyone,

I am a developer and new to Odoo 17. For a while now, I have been looking for a way to disable the 'Create' and 'Edit' suggestions that appear when searching for a specific value in a Many2One field.

I found a solution that allows this for a specific model, which is:


{'no_create': True}

This response does not work for me because it does not apply to all models. If you have a link to an article, forum, etc.

Any response is welcome.

 

Avatar
Vazgeç
Best Answer

In your case modify this line of odoo source code, i guess you know what to be modified

https://github.com/odoo/odoo/blob/17.0/addons/web/static/src/views/fields/many2one/many2one_field.js#L368

Avatar
Vazgeç
Best Answer

Hi,
You can use the web_m2x_options module by OCA, the v17 is not merged yet, once merged it will be available in:  https://github.com/OCA/web/tree/17.0

For now, you can download it from here:   https://github.com/DynAppsNV/web/tree/17.0-mig-web_m2x_options/web_m2x_options


Thanks

Avatar
Vazgeç
Üretici Best Answer

Hello, thank you very much for your response.

By modifying the following line to true, I get the behavior I want:

// Before
const canCreate = options.no_create ? false : hasCreatePermission;
// After
const canCreate = true ? false : hasCreatePermission;

Please refer to the GitHub link provided by @Duong Nguyen

How can I modify this value from another plugin?

Avatar
Vazgeç
Related Posts Cevaplar Görünümler Aktivite
4
Eki 24
1719
1
Tem 24
769
1
Haz 17
4773
0
Haz 24
70
1
Mar 22
9245