Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
5373 Переглядів

I would like to create a new field inside Contact model that would hold information about Allowed companies of the related user. Now Contact model have only field “company_id” that holds currently picked company of the related user and that is not enough for me.

I tried adding new field from Odoo developer interface like this:
https://i.imgur.com/e77znzH.png
but I have no idea how to populate this field with values from another model.

I was trying to do something similar to the field “company_id” inside Contacts but there is nothing that would lead me to the answer, it just works like magic and I suspect that the logic of assigning value to this field is hard coded inside python source code.

And almost none of premade fields use Advanced properties like Related field, Dependencies or Compute. Why? Does this properties have any purpose? I couldn’t find any use for them or detailed explanation. Can this field replace python code? I don’t get this.

Аватар
Відмінити
Найкраща відповідь

Hi,

See this video, this can give you some more ideas about adding the compute field from the front end: Odoo V12 - Calculated Field (commissions)

The above video demonstration is with Odoo EE and using the studio app, but for adding the compute field its same.


Thanks

Аватар
Відмінити
Автор Найкраща відповідь

But this video shows adding computed field based on value from the same model and it is not even many2many field.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
лип. 19
2857
3
вер. 20
2984
3
груд. 19
2937
1
лист. 19
4668
2
січ. 19
3432