From e9b56eafe2db066332d0065302ca10befa39f381 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 18 Jan 2011 18:49:56 +0200 Subject: [PATCH] docuement: armor the ir.action.report.xml code It was a little careless, better have an assertion there, at least, for the cases we don't cover. Historically, it has been here since commit: efeed12bea5c008ed6 ;) bzr revid: p_christ@hol.gr-20110118164956-vboodk5j4g9eofix --- addons/document/directory_report.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/document/directory_report.py b/addons/document/directory_report.py index 6eb18dae850..1665a7abf68 100644 --- a/addons/document/directory_report.py +++ b/addons/document/directory_report.py @@ -42,8 +42,12 @@ class ir_action_report_xml(osv.osv): def _model_search(self, cr, uid, obj, name, args, context=None): if not len(args): return [] + assert len(args) == 1 and args[0][1] == '=', 'expression is not what we expect: %r' % args model_id= args[0][2] if not model_id: + # a deviation from standard behavior: when searching model_id = False + # we return *all* reports, not just ones with empty model. + # One reason is that 'model' is a required field so far return [] model = self.pool.get('ir.model').read(cr, uid, [model_id])[0]['model'] report_id = self.search(cr, uid, [('model','=',model)])