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

Hello, I have Odoo8.

I have a model A with a many2many field which relates him with a model B. I want to filter this many2many field with a domain, which filters (not consider) all the B records which has one relation to any A record. How can I do this? Thanks!

Ảnh đại diện
Huỷ bỏ
Tác giả

@Ivan, thanks for your reply. In model B I don't have any reference to model A. How can count the number of model A related to model B in a function field?

Câu trả lời hay nhất

Create a function field in model B that counts the number of model A that relates to it, and then filter/domain based on that function field.  You need to set the fnct_search for the function field as well.

Ảnh đại diện
Huỷ bỏ

I have a similar problem, my field is m2m and I like to filter if it has more them one line, like this domain="[[u'tag_ids', u'&gt', 1]], but did not work and I don't have any ideia of how to make a function to count the number of rows, could you give some help?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
15941
naked domain set up Đã xử lý
3
thg 7 25
4418
0
thg 5 25
925
2
thg 3 24
2172
0
thg 1 23
1761