From c15c07c40517bfece5df66106772ed16eedcf6fa Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 14 Jul 2015 15:52:23 +0200 Subject: [PATCH] [FIX] expression: search inactive records for multi-path domains When searching records with a many2one multi-path domain e.g. [('employee_id.user_id', '=', uid)] on `hr.holidays`, inactive records were ignored e.g. if the employee of the leave request is disabled. For instance, this was not possible to search holidays of a disabled employee, while you would want to see holidays of an employee who is no longer working in the company. This leads to a huge change of behavior, and this is why we decided to not apply this fix within a stable release, such as 7.0 or 8.0, as companies in production might rely on the current behavior for their business, and changing this suddenly is not accepted. This must not be applied for one2many fields: Disabled records of a one2many fields must be considered as deleted. A search with a multi-path domain on a one2many must exlude inactive records. opw-644718 --- openerp/osv/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 391246b8dad..781d1aa87bf 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -844,7 +844,7 @@ class expression(object): raise NotImplementedError('_auto_join attribute not supported on many2many column %s' % left) elif len(path) > 1 and column._type == 'many2one': - right_ids = comodel.search(cr, uid, [(path[1], operator, right)], context=context) + right_ids = comodel.search(cr, uid, [(path[1], operator, right)], context=dict(context, active_test=False)) leaf.leaf = (path[0], 'in', right_ids) push(leaf)