[FIX] base : fix importing file with special character

To reproduce
============

for example on accounting, attempt to import a record from excel containing a special character like `%`.
Gets error stating the system doesn't support these

Purpose
=======

the issue is caused by misfromatted error string :
https://github.com/odoo/odoo/blob/b859d78c3d56526f44fbdd9ce5e84d34cf8a0a35/odoo/addons/base/models/ir_fields.py#L410-L411

Specification
=============

to solve the issue use :
`str(value).replace('%', '%%')`

opw-2838573

closes odoo/odoo#96336

X-original-commit: eb0152d4c5ec38c33ccc5381d1277543354e3456
Signed-off-by: abla001 <abla@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2022-07-19 21:22:09 +02:00
parent ddbe814cd5
commit 5bc83b046a
+1 -1
View File
@@ -408,7 +408,7 @@ class IrFieldsConverter(models.AbstractModel):
if len(ids) > 1:
warnings.append(ImportWarning(
_(u"Found multiple matches for value '%s' in field '%%(field)s' (%d matches)")
% (value, len(ids))))
%(str(value).replace('%', '%%'), len(ids))))
id, _name = ids[0]
else:
name_create_enabled_fields = self.env.context.get('name_create_enabled_fields') or {}