[FIX] base: Traceback when uploading a file with no ASCII name
When trying to upload a file with no ASCII name, it raised a traceback saying: "UnicodeEncodeError: 'ascii' codec can't encode character ..." opw:1886602
This commit is contained in:
@@ -4821,6 +4821,12 @@ msgstr ""
|
||||
msgid "A9 13 37 x 52 mm"
|
||||
msgstr ""
|
||||
|
||||
#. module: base
|
||||
#: code:addons/fields.py:1687
|
||||
#, python-format
|
||||
msgid "ASCII characters are required for %s in %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: base
|
||||
#: model:ir.model.fields,field_description:base.field_res_partner_title__shortcut
|
||||
msgid "Abbreviation"
|
||||
|
||||
+4
-1
@@ -1681,7 +1681,10 @@ class Binary(Field):
|
||||
return None
|
||||
if isinstance(value, bytes):
|
||||
return psycopg2.Binary(value)
|
||||
return psycopg2.Binary(pycompat.text_type(value).encode('ascii'))
|
||||
try:
|
||||
return psycopg2.Binary(pycompat.text_type(value).encode('ascii'))
|
||||
except UnicodeEncodeError:
|
||||
raise UserError(_("ASCII characters are required for %s in %s") % (value, self.name))
|
||||
|
||||
def convert_to_cache(self, value, record, validate=True):
|
||||
if isinstance(value, _BINARY):
|
||||
|
||||
Reference in New Issue
Block a user