diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 9bc9ad36b1d..3bbb87eefea 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -236,7 +236,7 @@ class view(osv.osv): ['type', '=', view_type], ['inherit_id', '=', False], ] - ids = self.search(cr, uid, domain, limit=1, order='priority', context=context) + ids = self.search(cr, uid, domain, limit=1, context=context) if not ids: return False return ids[0] diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index e9f4d8f59bd..8fe7bb1df7f 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -5083,7 +5083,14 @@ class BaseModel(object): # shortcut read if we only want the ids return [{'id': id} for id in record_ids] - result = self.read(cr, uid, record_ids, fields, context=context) + # read() ignores active_test, but it would forward it to any downstream search call + # (e.g. for x2m or function fields), and this is not the desired behavior, the flag + # was presumably only meant for the main search(). + # TODO: Move this to read() directly? + read_ctx = dict(context or {}) + read_ctx.pop('active_test', None) + + result = self.read(cr, uid, record_ids, fields, context=read_ctx) if len(result) <= 1: return result