[FIX] report: associated views with report name without dots

When setting a report with a `report_name` without dots,
the associated views button raised an exception.

This has been introduced during the migration to the new API
at revision 47c67b640b

Before, a try/except made sure the exception to not raise
the exception in case the report name could not be split
in two parts.

In this revision, instead of doing the try/except,
we check if the result of the split has a minimum
length of 2.

opw-706343
This commit is contained in:
Denis Ledoux
2017-02-03 11:19:01 +01:00
parent 01ac5949ef
commit 9c96631dde
@@ -17,7 +17,7 @@ class ir_actions_report(models.Model):
"""
self.ensure_one()
action_ref = self.env.ref('base.action_ui_view')
if not action_ref:
if not action_ref or len(self.report_name.split('.')) < 2:
return False
action_data = action_ref.read()[0]
action_data['domain'] = [('name', 'ilike', self.report_name.split('.')[1]), ('type', '=', 'qweb')]