Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
3064 Представления

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.

 

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Автор Лучший ответ

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?

Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
окт. 24
2605
1
июл. 24
1126
1
июн. 17
5274
0
июн. 24
70
1
мар. 22
9795