Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
b47ce0da
Commit
b47ce0da
authored
Sep 02, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix editable listbox cells to keep entered values when (un)selecting all lines
parent
c222dc58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
27 deletions
+9
-27
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+9
-27
No files found.
product/ERP5Form/ListBox.py
View file @
b47ce0da
...
...
@@ -2369,19 +2369,6 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
# Generate page selection methods based on the Listbox id
createFolderMixInPageSelectionMethod
(
field_id
)
# Check is there is a validation error at the level of the listbox
# as a whole. This will be required later to decide wherer to
# display values from (ie. from the REQUEST or from the object)
has_error
=
0
for
key
in
error_dict
.
keys
():
for
editable_id
in
editable_column_id_set
:
candidate_field_key
=
"%s_%s"
%
(
field_id
,
editable_id
)
if
key
.
startswith
(
candidate_field_key
):
has_error
=
1
break
if
has_error
:
break
for
(
original_value
,
processed_value
),
(
sql
,
title
),
alias
\
in
zip
(
self
.
getValueList
(),
renderer
.
getSelectedColumnList
(),
renderer
.
getColumnAliasList
()):
# By default, no error.
...
...
@@ -2462,20 +2449,15 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
key
=
'%s_%s'
%
(
editable_field
.
getId
(),
self
.
getUid
())
if
sql
in
editable_column_id_set
:
listbox_defines_column_as_editable
=
True
if
has_error
:
# If there is any error on listbox, we should use what the user has typed
display_value
=
None
else
:
validated_value_dict
=
request
.
get
(
field_id
,
None
)
if
validated_value_dict
is
None
:
# If this is neither an error nor a validated listbox
# we should use the original value
# Like any other field in ERP5, always use the value entered by the
# user if any. This duplicates some work done by field.render
try
:
display_value
=
editable_field
.
_get_user_input_value
(
editable_field
.
generate_field_key
(
key
=
key
),
request
)
except
(
KeyError
,
AttributeError
):
display_value
=
original_value
else
:
# If the listbox has been validated (ie. as it is the
# case whenever a relation field displays a popup menu)
# we have to use the value entered by the user
display_value
=
None
#
if
error_dict
.
has_key
(
key
):
# If error on current field, we should display message
# If error on current field, we should display message
if
key
in
error_dict
:
error_text
=
error_dict
[
key
].
error_text
error_text
=
cgi
.
escape
(
error_text
)
if
isinstance
(
error_text
,
str
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment