empty recordset. Why?

69 views Asked by At

In a Odoo 14 shell, I'm doing this

env['model_A'].search(['model_B_id', '=', '17' ])

I know for sure that there are several records in model_A with the field model_B_id set to 17

I get an empty recordset back

model_A()

Why ?

1

There are 1 answers

0
OpenCode On BEST ANSWER

The correct form of the search is

env['model_A'].search([('model_B_id', '=', 17)])

Elements to search must be a list of tuples and the many2one relation need an integer