[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) <nle@odoo.com>
This commit is contained in:
jerome hanke (jhk)
2020-08-03 07:04:36 +00:00
parent 1c21fcf275
commit 1e0f4188e5
+1 -1
View File
@@ -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: