diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml
index 4cc2774959e..9a6bf4a0503 100644
--- a/bin/addons/base/ir/ir.xml
+++ b/bin/addons/base/ir/ir.xml
@@ -102,36 +102,40 @@
form
diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py
index 1631d7e1229..0e2f61fd0ba 100644
--- a/bin/addons/base/ir/ir_model.py
+++ b/bin/addons/base/ir/ir_model.py
@@ -362,7 +362,8 @@ class ir_model_access(osv.osv):
except ValueError:
pass
- def call_cache_clearing_methods(self):
+ def call_cache_clearing_methods(self, cr):
+ self.check.clear_cache(cr.dbname) # clear the cache of check function
for model, method in self.__cache_clearing_methods:
getattr(self.pool.get(model), method)()
@@ -370,21 +371,18 @@ class ir_model_access(osv.osv):
# Check rights on actions
#
def write(self, cr, uid, *args, **argv):
- self.call_cache_clearing_methods()
+ self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).write(cr, uid, *args, **argv)
- self.check.clear_cache(cr.dbname) # clear the cache of check function
return res
def create(self, cr, uid, *args, **argv):
- self.call_cache_clearing_methods()
+ self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).create(cr, uid, *args, **argv)
- self.check.clear_cache(cr.dbname) # clear the cache of check function
return res
def unlink(self, cr, uid, *args, **argv):
- self.call_cache_clearing_methods()
+ self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).unlink(cr, uid, *args, **argv)
- self.check.clear_cache(cr.dbname) # clear the cache of check function
return res
ir_model_access()
diff --git a/bin/addons/base/ir/ir_sequence.py b/bin/addons/base/ir/ir_sequence.py
index 094fb114e7a..31828569d6c 100644
--- a/bin/addons/base/ir/ir_sequence.py
+++ b/bin/addons/base/ir/ir_sequence.py
@@ -69,7 +69,7 @@ class ir_sequence(osv.osv):
'sec': time.strftime('%S'),
}
- def get_id(self, cr, uid, sequence_id, test='id=%s'):
+ def get_id(self, cr, uid, sequence_id, test='id=%s', context={}):
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,))
res = cr.dictfetchone()
if res:
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py
index a4f822a5e16..984d67f01a2 100644
--- a/bin/addons/base/module/module.py
+++ b/bin/addons/base/module/module.py
@@ -487,6 +487,20 @@ class module(osv.osv):
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module %s: invalid quality certificate: %s' % (mod.name, mod.certificate))
raise osv.except_osv(_('Error'), _('Module %s: Invalid Quality Certificate') % (mod.name,))
+
+ def create(self, cr, uid, data, context={}):
+ id = super(module, self).create(cr, uid, data, context)
+ print 'Create', {
+ 'name': 'module_name_translation',
+ 'model': 'ir.module.module',
+ 'res_id': id,
+ }
+ self.pool.get('ir.model.data').create(cr, uid, {
+ 'name': 'module_name_translation',
+ 'model': 'ir.module.module',
+ 'res_id': id,
+ })
+ return id
module()
class module_dependency(osv.osv):
diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py
index 6b36d43b854..7f2d49bdfbd 100644
--- a/bin/addons/base/res/res_user.py
+++ b/bin/addons/base/res/res_user.py
@@ -48,7 +48,7 @@ class groups(osv.osv):
res = super(groups, self).write(cr, uid, ids, vals, context=context)
# Restart the cache on the company_get method
self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname)
- self.pool.get('ir.model.access').call_cache_clearing_methods()
+ self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
return res
def create(self, cr, uid, vals, context=None):
@@ -168,7 +168,7 @@ class users(osv.osv):
self.company_get.clear_cache(cr.dbname)
# Restart the cache on the company_get method
self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname)
- self.pool.get('ir.model.access').call_cache_clearing_methods()
+ self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
return res
def unlink(self, cr, uid, ids, context=None):
diff --git a/bin/tools/misc.py b/bin/tools/misc.py
index e47e36b80d1..04a1bba0ab5 100644
--- a/bin/tools/misc.py
+++ b/bin/tools/misc.py
@@ -99,6 +99,9 @@ def init_db(cr):
id, info.get('author', ''),
info.get('website', ''), i, info.get('name', False),
info.get('description', ''), p_id, state))
+ cr.execute('insert into ir_model_data \
+ (name,model,module, res_id) values (%s,%s,%s,%s)', (
+ 'module_meta_information', 'ir.module.module', i, id))
dependencies = info.get('depends', [])
for d in dependencies:
cr.execute('insert into ir_module_module_dependency \
@@ -828,6 +831,28 @@ def logged(f):
return wrapper
+class profile(object):
+ def __init__(self, fname=None):
+ self.fname = fname
+
+ def __call__(self, f):
+ from tools.func import wraps
+
+ @wraps(f)
+ def wrapper(*args, **kwargs):
+ class profile_wrapper(object):
+ def __init__(self):
+ self.result = None
+ def __call__(self):
+ self.result = f(*args, **kwargs)
+ pw = profile_wrapper()
+ import cProfile
+ fname = self.fname or ("%s.cprof" % (f.func_name,))
+ cProfile.runctx('pw()', globals(), locals(), filename=fname)
+ return pw.result
+
+ return wrapper
+
def debug(what):
"""
This method allow you to debug your code without print
diff --git a/bin/wizard/__init__.py b/bin/wizard/__init__.py
index 495e2344762..5635b1169dd 100644
--- a/bin/wizard/__init__.py
+++ b/bin/wizard/__init__.py
@@ -82,7 +82,7 @@ class interface(netsvc.Service):
if result_def['type'] == 'action':
res['action'] = result_def['action'](self, cr, uid, data, context)
elif result_def['type'] == 'form':
- fields = copy.copy(result_def['fields'])
+ fields = copy.deepcopy(result_def['fields'])
arch = copy.copy(result_def['arch'])
button_list = copy.copy(result_def['state'])