This question has been flagged
2 Replies
3938 Views

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.

Avatar
Discard
Best Answer

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

Avatar
Discard
Author Best Answer

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

Avatar
Discard