bzr revid: nicolas.vanhoren@openerp.com-20101026100039-dc9ev9f6lgbw3r66
This commit is contained in:
nvi-openerp 2010-10-26 12:00:39 +02:00
commit 5b7affd49f
8 changed files with 7549 additions and 3899 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-10-18 17:46+0000\n"
"PO-Revision-Date: 2010-10-24 15:16+0000\n"
"PO-Revision-Date: 2010-10-25 07:03+0000\n"
"Last-Translator: Chertykov Denis <chertykov@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-10-25 04:38+0000\n"
"X-Launchpad-Export-Date: 2010-10-26 04:36+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base

View File

@ -253,7 +253,8 @@ class act_window(osv.osv):
'search_view' : fields.function(_search_view, type='text', method=True, string='Search View'),
'menus': fields.char('Menus', size=4096),
'help': fields.text('Action description',
help='Optional help text for the users with a description of the target view, such as its usage and purpose.'),
help='Optional help text for the users with a description of the target view, such as its usage and purpose.',
translate=True),
'display_menu_tip':fields.function(_get_help_status, type='boolean', method=True, string='Display Menu Tips',
help='It gives the status if the tip has to be displayed or not when a user executes an action'),
'multi': fields.boolean('Action on Multiple Doc.', help="If set to true, the action will not be displayed on the right toolbar of a form view"),

View File

@ -1286,7 +1286,6 @@ class orm_template(object):
'fields': xfields
}
attrs = {'views': views}
view = False
fields = views.get('field', False) and views['field'].get('fields', False)
if node.get('name'):
attrs = {}
@ -2212,7 +2211,6 @@ class orm(orm_template):
fget = self.fields_get(cr, uid, fields)
float_int_fields = filter(lambda x: fget[x]['type'] in ('float', 'integer'), fields)
sum = {}
flist = ''
group_by = groupby
if groupby:
@ -2233,10 +2231,10 @@ class orm(orm_template):
or (f in self._columns and getattr(self._columns[f], '_classic_write'))]
for f in fields_pre:
if f not in ['id', 'sequence']:
operator = fget[f].get('group_operator', 'sum')
group_operator = fget[f].get('group_operator', 'sum')
if flist:
flist += ','
flist += operator+'('+f+') as '+f
flist += group_operator+'('+f+') as '+f
gb = groupby and (' GROUP BY '+groupby) or ''
@ -2971,26 +2969,6 @@ class orm(orm_template):
for key, v in r.items():
if v is None:
r[key] = False
if key in self._columns:
column = self._columns[key]
elif key in self._inherit_fields:
column = self._inherit_fields[key][2]
else:
continue
# TODO: removed this, it's too slow
# if v and column._type == 'reference':
# model_name, ref_id = v.split(',', 1)
# model = self.pool.get(model_name)
# if not model:
# reset = True
# else:
# cr.execute('SELECT count(1) FROM "%s" WHERE id=%%s' % (model._table,), (ref_id,))
# reset = not cr.fetchone()[0]
# if reset:
# if column._classic_write:
# query = 'UPDATE "%s" SET "%s"=NULL WHERE id=%%s' % (self._table, key)
# cr.execute(query, (r['id'],))
# r[key] = False
if isinstance(ids, (int, long, dict)):
return result and result[0] or False
@ -3213,17 +3191,21 @@ class orm(orm_template):
return
if not (context.get(self.CONCURRENCY_CHECK_FIELD) and self._log_access):
return
def key(oid):
return "%s,%s" % (self._name, oid)
santa = "(id = %s AND %s < COALESCE(write_date, create_date, now())::timestamp)"
for i in range(0, len(ids), cr.IN_MAX):
sub_ids = tools.flatten(((oid, context[self.CONCURRENCY_CHECK_FIELD][key(oid)])
for oid in ids[i:i+cr.IN_MAX]
if key(oid) in context[self.CONCURRENCY_CHECK_FIELD]))
if not sub_ids: continue
cr.execute("SELECT 1 FROM %s WHERE %s" % (self._table, " OR ".join([santa]*(len(sub_ids)/2))), sub_ids)
if cr.fetchone():
raise except_orm('ConcurrencyException', _('Records were modified in the meanwhile'))
check_clause = "(id = %s AND %s < COALESCE(write_date, create_date, now())::timestamp)"
for sub_ids in cr.split_for_in_conditions(ids):
ids_to_check = []
for id in sub_ids:
id_ref = "%s,%s" % (self._name, id)
update_date = context[self.CONCURRENCY_CHECK_FIELD].pop(id_ref, None)
if update_date:
ids_to_check.extend([id, update_date])
if not ids_to_check:
continue
cr.execute("SELECT id FROM %s WHERE %s" % (self._table, " OR ".join([check_clause]*(len(ids_to_check)/2))), tuple(ids_to_check))
res = cr.fetchone()
if res:
# mention the first one only to keep the error message readable
raise except_orm('ConcurrencyException', _('A document was modified since you last viewed it (%s:%d)') % (self._description, res[0]))
def check_access_rule(self, cr, uid, ids, operation, context=None):
"""Verifies that the operation given by ``operation`` is allowed for the user

View File

@ -55,7 +55,8 @@ _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [
_SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'STORE_MAP', 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR',
'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'JUMP_ABSOLUTE',
'DELETE_NAME', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE','MAKE_FUNCTION','JUMP_FORWARD'
'DELETE_NAME', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE','MAKE_FUNCTION','JUMP_FORWARD',
'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3'
] if x in opmap))
_logger = logging.getLogger('safe_eval')

View File

@ -303,7 +303,7 @@ class YamlInterpreter(object):
else:
self.validate_xml_id(record.id)
if self.isnoupdate(record) and self.mode != 'init':
id = self.pool.get('ir.model.data')._update_dummy(self.cr, self.uid, record.model, self.module, record.id)
id = self.pool.get('ir.model.data')._update_dummy(self.cr, 1, record.model, self.module, record.id)
# check if the resource already existed at the last update
if id:
self.id_map[record] = int(id)
@ -316,7 +316,7 @@ class YamlInterpreter(object):
self.logger.debug("RECORD_DICT %s" % record_dict)
#context = self.get_context(record, self.eval_context)
context = record.context #TOFIX: record.context like {'withoutemployee':True} should pass from self.eval_context. example: test_project.yml in project module
id = self.pool.get('ir.model.data')._update(self.cr, self.uid, record.model, \
id = self.pool.get('ir.model.data')._update(self.cr, 1, record.model, \
self.module, record_dict, record.id, noupdate=self.isnoupdate(record), mode=self.mode, context=context)
self.id_map[record.id] = int(id)
if config.get('import_partial'):
@ -569,7 +569,7 @@ class YamlInterpreter(object):
self._set_group_values(node, values)
pid = self.pool.get('ir.model.data')._update(self.cr, self.uid, \
pid = self.pool.get('ir.model.data')._update(self.cr, 1, \
'ir.ui.menu', self.module, values, node.id, mode=self.mode, \
noupdate=self.isnoupdate(node), res_id=res and res[0] or False)
@ -580,7 +580,7 @@ class YamlInterpreter(object):
action_type = node.type or 'act_window'
action_id = self.get_id(node.action)
action = "ir.actions.%s,%d" % (action_type, action_id)
self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \
self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \
'tree_but_open', 'Menuitem', [('ir.ui.menu', int(parent_id))], action, True, True, xml_id=node.id)
def process_act_window(self, node):
@ -614,7 +614,7 @@ class YamlInterpreter(object):
if node.target:
values['target'] = node.target
id = self.pool.get('ir.model.data')._update(self.cr, self.uid, \
id = self.pool.get('ir.model.data')._update(self.cr, 1, \
'ir.actions.act_window', self.module, values, node.id, mode=self.mode)
self.id_map[node.id] = int(id)
@ -622,7 +622,7 @@ class YamlInterpreter(object):
keyword = 'client_action_relate'
value = 'ir.actions.act_window,%s' % id
replace = node.replace or True
self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', keyword, \
self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', keyword, \
node.id, [node.src_model], value, replace=replace, noupdate=self.isnoupdate(node), isobject=True, xml_id=node.id)
# TODO add remove ir.model.data
@ -635,7 +635,7 @@ class YamlInterpreter(object):
ids = [self.get_id(node.id)]
if len(ids):
self.pool.get(node.model).unlink(self.cr, self.uid, ids)
self.pool.get('ir.model.data')._unlink(self.cr, self.uid, node.model, ids)
self.pool.get('ir.model.data')._unlink(self.cr, 1, node.model, ids)
else:
self.logger.log(logging.TEST, "Record not deleted.")
@ -644,7 +644,7 @@ class YamlInterpreter(object):
res = {'name': node.name, 'url': node.url, 'target': node.target}
id = self.pool.get('ir.model.data')._update(self.cr, self.uid, \
id = self.pool.get('ir.model.data')._update(self.cr, 1, \
"ir.actions.url", self.module, res, node.id, mode=self.mode)
self.id_map[node.id] = int(id)
# ir_set
@ -652,7 +652,7 @@ class YamlInterpreter(object):
keyword = node.keyword or 'client_action_multi'
value = 'ir.actions.url,%s' % id
replace = node.replace or True
self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \
self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \
keyword, node.url, ["ir.actions.url"], value, replace=replace, \
noupdate=self.isnoupdate(node), isobject=True, xml_id=node.id)
@ -667,7 +667,7 @@ class YamlInterpreter(object):
else:
value = expression
res[fieldname] = value
self.pool.get('ir.model.data').ir_set(self.cr, self.uid, res['key'], res['key2'], \
self.pool.get('ir.model.data').ir_set(self.cr, 1, res['key'], res['key2'], \
res['name'], res['models'], res['value'], replace=res.get('replace',True), \
isobject=res.get('isobject', False), meta=res.get('meta',None))
@ -692,7 +692,7 @@ class YamlInterpreter(object):
self._set_group_values(node, values)
id = self.pool.get('ir.model.data')._update(self.cr, self.uid, "ir.actions.report.xml", \
id = self.pool.get('ir.model.data')._update(self.cr, 1, "ir.actions.report.xml", \
self.module, values, xml_id, noupdate=self.isnoupdate(node), mode=self.mode)
self.id_map[xml_id] = int(id)
@ -700,7 +700,7 @@ class YamlInterpreter(object):
keyword = node.keyword or 'client_print_multi'
value = 'ir.actions.report.xml,%s' % id
replace = node.replace or True
self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \
self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \
keyword, values['name'], [values['model']], value, replace=replace, isobject=True, xml_id=xml_id)
def process_none(self):

View File

@ -4,7 +4,7 @@ import logging
class YamlTag(object):
"""
Superclass for constructors of custom tags defined in yaml file.
__str__ are overriden in subclass and used for serialization in module recorder.
__str__ is overriden in subclass and used for serialization in module recorder.
"""
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
@ -89,14 +89,14 @@ class Eval(YamlTag):
self.expression = expression
super(Eval, self).__init__()
def __str__(self):
return 'eval(%s)' % (str(self.expr,))
return '!eval %s' % str(self.expression)
class Ref(YamlTag):
def __init__(self, expr="False", *args, **kwargs):
self.expr = expr
super(Ref, self).__init__(*args, **kwargs)
def __str__(self):
return 'ref(%s)' % (str(self.expr,))
return 'ref(%s)' % repr(self.expr)
class IrSet(YamlTag):
def __init__(self):