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

for example; I want to do a search on sale.order model and get the records that the partner_id object's parent_id is equal to '1'. How can I achieve?

self.env['sale.order].search(['???' , '=', '1']) can ??? be partner_id.parent_id ???

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

On Wed, Feb 24, 2021 at 5:40 AM Cristina.J <mariemjallouli@gmail.com> wrote:

Une nouvelle question Odoov13 join two many2one fileds while setting query domain le Aide a été publiée. Cliquez ici pour accéder à la question :

Voir la question

Envoyé par Odoo S.A. utilisant Odoo.

Tác giả Câu trả lời hay nhất

self.env['sale.order].search(['partner_id.parent_id' , '=', '1']) works as well as sale_orders = self.env['sale.order].search([]).filtered(lambda so: so.partner_id.parent_id == 1)

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

You can not achieve this using domain on search method. However, you can grab all sale orders and then filter them like this:

sale_orders = self.env['sale.order].search([]).filtered(lambda so: so.partner_id.parent_id == 1)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 10 22
4472
8
thg 2 17
9060
0
thg 1 17
6364
2
thg 2 24
13305
4
thg 5 24
19358