Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4932 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 19
2525
3
thg 9 20
2502
3
thg 12 19
2568
1
thg 11 19
4142
2
thg 1 19
3114