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

I have a test company created with 2 contacts.

I would like that in my module when I select the Company (marked is company) that in another field it only shows contact for that company

In developer mode, I found contacts to have name "child_ids" and I thought maybe if I added this:

<field name="res_partner_id" domain="[('child_ids', '=', True)]" />

it would work:

However it gives error:


ProgrammingError: operator does not exist: integer = boolean

LINE 1: SELECT "parent_id" FROM "res_partner" WHERE "id" IN (true)

^

HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.


Any ideas on how to fix this?

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

Found solution. It needs to be filter on the parent not the child:


<field name="res_partner_id" domain="[('parent_id', '=', res_partner_id)]" />

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

Try this (False is set when list is empty, if is not empty .... not equals True):

<field name="res_partner_id" domain="[('child_ids', '!=', False)]" /> 
Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Zbik but that just gave me the customer names and not the contacts associate with the customer

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 24
4313
1
thg 11 22
2340
2
thg 3 18
11583
1
thg 8 24
1591
0
thg 2 24
1701