[MERGE]
bzr revid: christophe@tinyerp.com-20090127085239-l3yosvvlyvtu9btt
This commit is contained in:
commit
11d1e0c6ce
|
@ -102,36 +102,40 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sequences">
|
||||
<separator colspan="4" string="Configuration"/>
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
<field name="prefix"/>
|
||||
<field name="suffix"/>
|
||||
<field name="padding"/>
|
||||
<field name="number_increment"/>
|
||||
<field name="number_next"/>
|
||||
<separator colspan="4" string="Legend (for prefix, suffix)"/>
|
||||
<group col="8" colspan="4">
|
||||
<group>
|
||||
<label colspan="4" string="Year with century: %%(year)s"/>
|
||||
<label colspan="4" string="Year without century: %%(y)s"/>
|
||||
<label colspan="4" string="Month: %%(month)s"/>
|
||||
<label colspan="4" string="Day: %%(day)s"/>
|
||||
</group>
|
||||
<group>
|
||||
<label colspan="4" string="Day of the year: %%(doy)s"/>
|
||||
<label colspan="4" string="Week of the year: %%(woy)s"/>
|
||||
<label colspan="4" string="Day of the week (0:Monday): %%(weekday)s"/>
|
||||
</group>
|
||||
<group>
|
||||
<label colspan="4" string="Hour 00->24: %%(h24)s"/>
|
||||
<label colspan="4" string="Hour 00->12: %%(h12)s"/>
|
||||
<label colspan="4" string="Minute: %%(min)s"/>
|
||||
<label colspan="4" string="Seconde: %%(sec)s"/>
|
||||
</group>
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="active" select="2"/>
|
||||
</group>
|
||||
<separator colspan="4" string=""/>
|
||||
<notebook>
|
||||
<page string="Sequence">
|
||||
<field name="prefix"/>
|
||||
<field name="suffix"/>
|
||||
<field name="padding"/>
|
||||
<field name="number_increment"/>
|
||||
<field name="number_next"/>
|
||||
<separator colspan="4" string="Legend (for prefix, suffix)"/>
|
||||
<group col="8" colspan="4">
|
||||
<group>
|
||||
<label colspan="4" string="Year with century: %%(year)s"/>
|
||||
<label colspan="4" string="Year without century: %%(y)s"/>
|
||||
<label colspan="4" string="Month: %%(month)s"/>
|
||||
<label colspan="4" string="Day: %%(day)s"/>
|
||||
</group>
|
||||
<group>
|
||||
<label colspan="4" string="Day of the year: %%(doy)s"/>
|
||||
<label colspan="4" string="Week of the year: %%(woy)s"/>
|
||||
<label colspan="4" string="Day of the week (0:Monday): %%(weekday)s"/>
|
||||
</group>
|
||||
<group>
|
||||
<label colspan="4" string="Hour 00->24: %%(h24)s"/>
|
||||
<label colspan="4" string="Hour 00->12: %%(h12)s"/>
|
||||
<label colspan="4" string="Minute: %%(min)s"/>
|
||||
<label colspan="4" string="Seconde: %%(sec)s"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue