Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4993 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 19
2570
3
wrz 20
2586
3
gru 19
2641
1
lis 19
4245
2
sty 19
3152