From 1e0f4188e5ff218324229f9570fe6f6ec545e575 Mon Sep 17 00:00:00 2001 From: "jerome hanke (jhk)" Date: Sun, 12 Jul 2020 23:18:16 +0000 Subject: [PATCH] [FIX] odoo: one2many fields queries with res_id are narrowed by res_model Steps to reproduce: - install helpdesk, hr_expense (the demo data has a clear example of the bug) - go to helpdesk > tickets > set a custom filter > "activities is set" Previous behavior: the results show the ticket with id=2 as if it had an activity set. Because the search sql query collides with other activities set on other models (hr.expense.sheet in this example) Current behavior: the sql query returns the proper result opw-2273680 closes odoo/odoo#55297 X-original-commit: 6e90c41413f6a726c08071c71d01c738a6538079 Signed-off-by: Nicolas Lempereur (nle) --- odoo/osv/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/osv/expression.py b/odoo/osv/expression.py index 5be77f295a8..14d38dedbba 100644 --- a/odoo/osv/expression.py +++ b/odoo/osv/expression.py @@ -800,7 +800,7 @@ class expression(object): elif field.type == 'one2many': domain = field.get_domain_list(model) - inverse_is_int = comodel._fields[field.inverse_name].type == 'integer' + inverse_is_int = comodel._fields[field.inverse_name].type in ('integer', 'many2one_reference') unwrap_inverse = (lambda ids: ids) if inverse_is_int else (lambda recs: recs.ids) if right is not False: