Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
3057 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Beste antwoord

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
Annuleer
Auteur Beste antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
4
okt. 24
2601
1
jul. 24
1125
1
jun. 17
5256
0
jun. 24
70
1
mrt. 22
9791