This commit is contained in:
Bertrand Chenal
2008-01-11 00:12:18 +01:00
5 changed files with 7 additions and 46 deletions
-2
View File
@@ -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,
}
+1 -15
View File
@@ -172,21 +172,7 @@ class OSV(ORM):
"""
if pool.get(cls._name):
parent_class = pool.get(cls._name).__class__
nattr = {}
for i in (
'_columns',
'_defaults',
'_inherits',
'_constraints',
'_sql_constraints',
):
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)
cls = type(cls._name, (cls, parent_class), {})
obj = object.__new__(cls)
obj.__init__(pool)
-2
View File
@@ -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
+5 -15
View File
@@ -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:
@@ -114,18 +114,7 @@ class Report(object):
"""
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)
cls = type(cls._name, (cls, parent_class), {})
obj = object.__new__(cls)
obj.__init__(pool, pool_obj)
@@ -134,7 +123,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__()
+1 -12
View File
@@ -116,18 +116,7 @@ class Wizard(object):
"""
if pool.get(cls._name):
parent_class = pool.get(cls._name).__class__
new_states = copy.copy(getattr(pool.get(cls._name), 'states'))
for i in (
'actions',
'result',
):
new = copy.copy(getattr(new_states, i))
if hasattr(new, 'update'):
new.update(cls.__dict__.get(i, {}))
else:
new.extend(cls.__dict__.get(i, []))
new_states[i] = new
cls = type(cls._name, (cls, parent_class), {'states': new_states})
cls = type(cls._name, (cls, parent_class), {})
obj = object.__new__(cls)
obj.__init__(pool, pool_obj)