[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 5229 revid:launchpad_translations_on_behalf_of_openerp-20140211064034-ghuxxk02n715othj

bzr revid: dle@openerp.com-20140211163902-ya86jr7lwlj1mkk9
This commit is contained in:
Denis Ledoux 2014-02-11 17:39:02 +01:00
commit 1b2c0f74dc
3 changed files with 21 additions and 12 deletions

View File

@ -54,6 +54,8 @@ class change_password_wizard(osv.TransientModel):
for user in wizard.user_ids:
user_ids.append(user.id)
self.pool.get('change.password.user').change_password_button(cr, uid, user_ids, context=context)
# don't keep temporary password copies in the database longer than necessary
self.pool.get('change.password.user').unlink(cr, uid, user_ids)
return {
'type': 'ir.actions.act_window_close',
}

View File

@ -5038,24 +5038,22 @@ class BaseModel(object):
blacklist_given_fields(self)
fields_to_read = [f for f in self.check_field_access_rights(cr, uid, 'read', None)
if f not in blacklist]
data = self.read(cr, uid, [id], fields_to_read, context=context)
fields_to_copy = dict((f,fi) for f, fi in self._all_columns.iteritems()
if f not in default
if f not in blacklist
if not isinstance(fi.column, fields.function))
data = self.read(cr, uid, [id], fields_to_copy.keys(), context=context)
if data:
data = data[0]
else:
raise IndexError(_("Record #%d of %s not found, cannot copy!") % (id, self._name))
raise IndexError( _("Record #%d of %s not found, cannot copy!") %( id, self._name))
res = dict(default)
for f, colinfo in self._all_columns.items():
for f, colinfo in fields_to_copy.iteritems():
field = colinfo.column
if f in default:
pass
elif f in blacklist:
pass
elif isinstance(field, fields.function):
pass
elif field._type == 'many2one':
if field._type == 'many2one':
res[f] = data[f] and data[f][0]
elif field._type == 'one2many':
other = self.pool[field._obj]

View File

@ -100,6 +100,15 @@ def html_sanitize(src, silent=True):
raise
logger.warning('unknown error obtained when sanitizing %r', src, exc_info=True)
cleaned = '<p>Unknown error when sanitizing</p>'
# MAKO compatibility: $, { and } inside quotes are escaped, preventing correct mako execution
cleaned = cleaned.replace('%24', '$')
cleaned = cleaned.replace('%7B', '{')
cleaned = cleaned.replace('%7D', '}')
cleaned = cleaned.replace('%20', ' ')
cleaned = cleaned.replace('%5B', '[')
cleaned = cleaned.replace('%5D', ']')
return cleaned