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

I'm trying to retrieve from script all the product published except for one category, this method is invoked by an automadet action. The code is:




The issue is that the search is returning all the product template, not only the website_published = true, can anyone help to understand the issue in the code?


Thank you.

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

Hi,

    Try giving the reverse way, ('website_published', '!=', False)

    The domain inside the search normally uses the AND operation , you need not mention and in between your conditions. You can simply give a "comma", [('website_published', '!=', False), ('public_categ_ids', 'not in', (7)]. This is just for your information. 
I guess the domain fails due to your second condition, i guess public_categ_ids is a many2many field so try giving as above

Hope it helps.

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

Thank you a lot, it worked fine!

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

Happy to help. Thanks

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 24
1690
1
thg 11 22
14140
2
thg 7 22
5398
1
thg 11 20
2647
1
thg 11 17
4306