details:   https://code.openbravo.com/erp/devel/pi/rev/2ae5f4a8e8da
changeset: 33428:2ae5f4a8e8da
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Feb 14 09:40:23 2018 +0100
summary:   Fixes issue 37842: Callouts are invoked when clearing a non 
mandatory selector

This changeset [1] fixed a problem where a callout was being called twice when 
picking a value from a selector. The first request was done properly, but the
second one was done with a null value. The fix consisted in not notifying a 
change in selector when it was modified from a non-empty value to an empty 
value.

But as a result, when a non mandatory selector is emptied, callouts are no 
longer being invoked. The original issue is very hard to reproduce, I have not 
been
able to find a new way to reproduce it or fix it. To avoid the regression, now 
the code that was done to fix [1] will only take place if the selector is 
mandatory,
to make sure that it is possible to give empty values to non-mandatory 
selectors.

[1] 
https://code.openbravo.com/erp/devel/pi/rev/baf72de5b678a308c36d5946af3e143d08625eca

diffstat:

 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 4f7e83a9ad57 -r 2ae5f4a8e8da 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Tue Feb 13 12:08:43 2018 +0100
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Wed Feb 14 09:40:23 2018 +0100
@@ -656,7 +656,7 @@
     // only do the identifier actions when clearing
     // in all other cases pickValue is called
     if (!newValue) {
-      if (this.getElementValue() === '' && this.pickList && 
this.pickList.getSelectedRecord() && this.pickList.getSelectedRecord().id) {
+      if (this.required && this.getElementValue() === '' && this.pickList && 
this.pickList.getSelectedRecord() && this.pickList.getSelectedRecord().id) {
         // handle special case: after selecting a value, a redraw is fired in 
the form.
         // due to asynchrony problems, the redraw flow was able to access to 
_value before setting it with the current value.
         // if we are in this case, then we do not need to continue setting the 
value because 'null' is not the value to be assigned.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to