[REF] report_webkit: unlink/create/write are wrong.

Their changes are not propagated to other processes in a
multi-process setting.

It means that now calling these on auto=False webkit reports
will not have the desired effect. But really they can be updated
to use the new XML parser attribute, and the create/write/unlink
features should be on the base class, not in this module.

bzr revid: vmt@openerp.com-20130322152741-zdmwga2u7uqsv2c3
This commit is contained in:
Vo Minh Thu 2013-03-22 16:27:41 +01:00
parent 36d25e4d78
commit 6e146e1551
1 changed files with 0 additions and 56 deletions

View File

@ -50,62 +50,6 @@ def register_report(name, model, tmpl_path, parser=rml_parse):
class ReportXML(osv.osv):
def unlink(self, cursor, user, ids, context=None):
"""Delete report and unregister it"""
trans_obj = self.pool.get('ir.translation')
trans_ids = trans_obj.search(
cursor,
user,
[('type', '=', 'report'), ('res_id', 'in', ids)]
)
trans_obj.unlink(cursor, user, trans_ids)
# Warning: we cannot unregister the services at the moment
# because they are shared across databases. Calling a deleted
# report will fail so it's ok.
res = super(ReportXML, self).unlink(
cursor,
user,
ids,
context
)
return res
def create(self, cursor, user, vals, context=None):
"Create report and register it"
res = super(ReportXML, self).create(cursor, user, vals, context)
if vals.get('report_type','') == 'webkit':
# I really look forward to virtual functions :S
register_report(
vals['report_name'],
vals['model'],
vals.get('report_rml', False)
)
return res
def write(self, cr, uid, ids, vals, context=None):
"Edit report and manage it registration"
if isinstance(ids, (int, long)):
ids = [ids,]
for rep in self.browse(cr, uid, ids, context=context):
if rep.report_type != 'webkit':
continue
if vals.get('report_name', False) and \
vals['report_name'] != rep.report_name:
report_name = vals['report_name']
else:
report_name = rep.report_name
register_report(
report_name,
vals.get('model', rep.model),
vals.get('report_rml', rep.report_rml)
)
res = super(ReportXML, self).write(cr, uid, ids, vals, context)
return res
_name = 'ir.actions.report.xml'
_inherit = 'ir.actions.report.xml'
_columns = {