Use data's action_id to find report to use
issue4411 review10741002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Use action_id to find report to use
|
||||
* Allow custom StateView without Model
|
||||
* Remove Pool.object_name_list
|
||||
* Add translated descriptor for Dict field
|
||||
|
||||
@@ -477,10 +477,6 @@ class ActionReport(ActionMixin, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ActionReport, cls).__setup__()
|
||||
cls._sql_constraints += [
|
||||
('report_name_module_uniq', 'UNIQUE(report_name, module)',
|
||||
'The internal name must be unique by module!'),
|
||||
]
|
||||
cls._error_messages.update({
|
||||
'invalid_email': 'Invalid email definition on report "%s".',
|
||||
})
|
||||
@@ -544,6 +540,9 @@ class ActionReport(ActionMixin, ModelSQL, ModelView):
|
||||
where=action_report.id == report_id))
|
||||
table.drop_column('report_content_data')
|
||||
|
||||
# Migration from 3.4 remove report_name_module_uniq constraint
|
||||
table.drop_constraint('report_name_module_uniq')
|
||||
|
||||
@staticmethod
|
||||
def default_type():
|
||||
return 'ir.action.report'
|
||||
|
||||
@@ -130,13 +130,18 @@ class Report(URLMixin, PoolBase):
|
||||
'''
|
||||
pool = Pool()
|
||||
ActionReport = pool.get('ir.action.report')
|
||||
action_reports = ActionReport.search([
|
||||
('report_name', '=', cls.__name__)
|
||||
])
|
||||
if not action_reports:
|
||||
raise Exception('Error', 'Report (%s) not find!' % cls.__name__)
|
||||
cls.check_access()
|
||||
action_report = action_reports[0]
|
||||
|
||||
action_id = data.get('action_id')
|
||||
if action_id is None:
|
||||
action_reports = ActionReport.search([
|
||||
('report_name', '=', cls.__name__)
|
||||
])
|
||||
assert action_reports, '%s not found' % cls
|
||||
action_report = action_reports[0]
|
||||
else:
|
||||
action_report = ActionReport(action_id)
|
||||
|
||||
records = None
|
||||
model = action_report.model or data.get('model')
|
||||
if model:
|
||||
|
||||
Reference in New Issue
Block a user