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 ???
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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 ???
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)
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)
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati| Post correlati | Risposte | Visualizzazioni | Attività | |
|---|---|---|---|---|
|
Domain with inherited field
Risolto
|
|
1
ott 22
|
4465 | |
|
|
8
feb 17
|
9049 | ||
|
|
0
gen 17
|
6342 | ||
|
|
2
feb 24
|
13280 | ||
|
|
4
mag 24
|
19332 |