Commit d8d8ee83 authored by Jérome Perrin's avatar Jérome Perrin

project: fix injecting error messages from action script

This uses an internal API that has changed in 0aeea3c4 (Validation
message translation, 2021-01-06)
parent 940f40ce
...@@ -7,7 +7,7 @@ portal = context.getPortalObject() ...@@ -7,7 +7,7 @@ portal = context.getPortalObject()
line_portal_type = "Sale Order Line" line_portal_type = "Sale Order Line"
request = context.REQUEST request = context.REQUEST
from string import zfill from string import zfill
from Products.ERP5Type.Document import newTempBase from Products.PythonScripts.standard import Object
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
context.log('original listbox', listbox) context.log('original listbox', listbox)
...@@ -65,9 +65,12 @@ for line in line_list: ...@@ -65,9 +65,12 @@ for line in line_list:
else: else:
line_dict['source_project_relative_url'] = result[0].getRelativeUrl() line_dict['source_project_relative_url'] = result[0].getRelativeUrl()
if error_message: if error_message:
error = newTempBase(context, key) validation_errors['listbox_source_project_title_new_%s' % key] = Object(
error.edit(error_text=error_message) field_id='listbox_source_project_title_new_%s' % key,
validation_errors['listbox_source_project_title_new_%s' % key] = error getMessage=lambda translateString: translateString(error_message),
)
)
listbox.append(line_dict) listbox.append(line_dict)
i += 1 i += 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment