Instanciate report object on demand and remove tricky update dict on
inherited report
This commit is contained in:
1 parent
6082567348
commit
75c4e2b3ed
3 files changed
+4
-19
No files matched your search
@@ -107,11 +107,9 @@ class ActionsReport(OSV):
|
||||
'report_content': fields.function(_report_content,
|
||||
fnct_inv=_report_content_inv, method=True,
|
||||
type='binary', string='Content',),
|
||||
'auto': fields.boolean('Automatic', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'type': lambda *a: 'ir.actions.report',
|
||||
'auto': lambda *a: True,
|
||||
'report_content': lambda *a: False,
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@ def get_db_and_pool(db_name, force_demo=False, update_module=False,
|
||||
load_modules(database, force_demo, update_module)
|
||||
|
||||
if not update_module:
|
||||
#import report
|
||||
#report.interface.register_all(database)
|
||||
pool.get('ir.cron').pool_jobs(database.dbname)
|
||||
if wizard:
|
||||
return database, pool_wizard
|
||||
|
||||
@@ -30,8 +30,8 @@ class ReportService(Service):
|
||||
try:
|
||||
report = pooler.get_pool_report(cursor.dbname).get(report_name)
|
||||
if not report:
|
||||
self.abort_response('Report Error', 'warning',
|
||||
'Report %s doesn\'t exist' % str(report_name))
|
||||
report = Report.create_instance(self, 'report', pooler.get_pool(cursor.dbname))
|
||||
report._name = report_name
|
||||
res = report.execute(cursor, user, ids, datas, context)
|
||||
return res
|
||||
except ExceptORM, inst:
|
||||
@@ -113,20 +113,8 @@ class Report(object):
|
||||
put objs in the pool var
|
||||
"""
|
||||
if pool.get(cls._name):
|
||||
parent_class = pool.get(cls._name).__class__
|
||||
nattr = {}
|
||||
for i in (
|
||||
'_context',
|
||||
):
|
||||
new = copy.copy(getattr(pool.get(cls._name), i))
|
||||
if hasattr(new, 'update'):
|
||||
new.update(cls.__dict__.get(i, {}))
|
||||
else:
|
||||
new.extend(cls.__dict__.get(i, []))
|
||||
nattr[i] = new
|
||||
cls = type(cls._name, (cls, parent_class), nattr)
|
||||
|
||||
|
||||
obj = object.__new__(cls)
|
||||
obj.__init__(pool, pool_obj)
|
||||
return obj
|
||||
@@ -134,7 +122,8 @@ class Report(object):
|
||||
create_instance = classmethod(create_instance)
|
||||
|
||||
def __init__(self, pool, pool_obj):
|
||||
pool.add(self._name, self)
|
||||
if self._name:
|
||||
pool.add(self._name, self)
|
||||
self.pool = pool_obj
|
||||
super(Report, self).__init__()
|
||||
|
||||
|
||||
Reference in new issue
Block a user