Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
2269 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Paras vastaus

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
Hylkää
Tekijä Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
4
lokak. 24
1767
1
heinäk. 24
790
1
kesäk. 17
4808
0
kesäk. 24
70
1
maalisk. 22
9279