Skip to content

Commit

Permalink
[MERGE] forward port branch saas-14 up to 2bc3fd8
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Apr 23, 2018
2 parents 4ac10f2 + 2bc3fd8 commit 0bf642c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addons/l10n_mx/data/account_tag_data.xml
Expand Up @@ -5399,7 +5399,7 @@
<field name='name'>802.02 Contra cuenta CUFIN</field>
<field name='color'>4</field>
<field name='applicability'>accounts</field>
<field name='nature'>D</field>
<field name='nature'>A</field>
</record>
<record id='account_tag_803_01' model='account.account.tag'>
<field name='name'>803.01 CUFIN de ejercicios anteriores</field>
Expand Down
16 changes: 12 additions & 4 deletions addons/web/controllers/main.py
Expand Up @@ -25,6 +25,7 @@
import zlib
from xml.etree import ElementTree
from cStringIO import StringIO
import unicodedata


import odoo
Expand Down Expand Up @@ -1073,20 +1074,27 @@ def upload_attachment(self, callback, model, id, ufile):
</script>"""
args = []
for ufile in files:

filename = ufile.filename
if request.httprequest.user_agent.browser == 'safari':
# Safari sends NFD UTF-8 (where é is composed by 'e' and [accent])
# we need to send it the same stuff, otherwise it'll fail
filename = unicodedata.normalize('NFD', ufile.filename).encode('UTF-8')

try:
attachment = Model.create({
'name': ufile.filename,
'name': filename,
'datas': base64.encodestring(ufile.read()),
'datas_fname': ufile.filename,
'datas_fname': filename,
'res_model': model,
'res_id': int(id)
})
except Exception:
args = args.append({'error': _("Something horrible happened")})
args.append({'error': _("Something horrible happened")})
_logger.exception("Fail to upload attachment %s" % ufile.filename)
else:
args.append({
'filename': ufile.filename,
'filename': filename,
'mimetype': ufile.content_type,
'id': attachment.id
})
Expand Down
2 changes: 1 addition & 1 deletion addons/web/static/src/js/views/list_view.js
Expand Up @@ -1089,7 +1089,7 @@ ListView.List = Class.extend({
value = record.get(column.id);
// non-resolved (string) m2m values are arrays
if (value instanceof Array && !_.isEmpty(value)
&& !record.get(column.id + '__display')) {
&& (!record.get(column.id + '__display') && record.get(column.id + '__display') !== '')) {
var ids;
// they come in two shapes:
if (value[0] instanceof Array) {
Expand Down
10 changes: 9 additions & 1 deletion addons/web_editor/static/src/js/rte.summernote.js
Expand Up @@ -666,7 +666,15 @@ function summernote_mousedown (event) {
}

// restore range if range lost after clicking on non-editable area
r = range.create();
try {
r = range.create();
} catch (e) {
// If this code is running inside an iframe-editor and that the range
// is outside of this iframe, this will fail as the iframe does not have
// the permission to check the outside content this way. In that case,
// we simply ignore the exception as it is as if there was no range.
return;
}
var editables = $(".o_editable[contenteditable], .note-editable[contenteditable]");
var r_editable = editables.has((r||{}).sc);
if (!r_editable.closest('.note-editor').is($editable) && !r_editable.filter('.o_editable').is(editables)) {
Expand Down
2 changes: 1 addition & 1 deletion odoo/addons/base/ir/ir_ui_view.py
Expand Up @@ -1157,7 +1157,7 @@ def _validate_custom_views(self, model):
query = """SELECT max(v.id)
FROM ir_ui_view v
LEFT JOIN ir_model_data md ON (md.model = 'ir.ui.view' AND md.res_id = v.id)
WHERE md.module NOT IN (SELECT name FROM ir_module_module)
WHERE md.module IN (SELECT name FROM ir_module_module) IS NOT TRUE
AND v.model = %s
AND v.active = true
GROUP BY coalesce(v.inherit_id, v.id)"""
Expand Down

0 comments on commit 0bf642c

Please sign in to comment.