Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029567Openbravo ERPA. Platformpublic2015-04-09 10:452015-04-14 18:02
umartirena 
caristu 
immediateminoralways
closedfixed 
5
 
3.0PR15Q23.0PR15Q2 
AugustoMauch
Core
No
0029567: onChange event does not work fine using Date parameters in Process Definition
If an Onchange javascript function is added to a Date Parameter in a Process Definition, the event is only raised the first time that the value is changed using the calendar element. And is executed when manually changing the focus to another place.
It would be great to not to be necessary to change the focus manually.

When the value is changed directly in the field using keyboard the event gets executed always, but does not work as expected after the first execution.
As System Administrator:
* Go to Process Definition window and select Add Transaction record.
* In trxdate parameter add the following value in OnChange Function: OB.APRM.AddTransaction.trxDateOnChangeFunction
* In ob-aprm-addTransaction.js and the following piece of code:
OB.APRM.AddTransaction.trxDateOnChangeFunction = function (item, view, form, grid) {
    form.getItem('dateacct').setValue(new Date(item.getValue()));
};

As F&B Group Admin:
* Go to Financial Account window. Select "Bank - Account 1".
* Go to Imported Bank Statements tab. Create a Header.
* Create a Bank Statement Line. Amount Out 10. Process it.
* Click on Match Statement. Cancel the displayed popup.
* Select the previously created line and click on Add Transaction.
* Change Transaction Date using the calendar element or manually.
* Notice that the behavior described above happens.
No tags attached.
blocks defect 0029544 closed caristu onChange event does not work fine using Date parameters in Process Definition 
Issue History
2015-04-13 08:48alostaleTypedefect => backport
2015-04-13 08:48alostaleTarget Version => 3.0PR15Q2
2015-04-14 13:44caristuReview Assigned To => AugustoMauch
2015-04-14 13:45caristuIssue Monitored: AugustoMauch
2015-04-14 13:45hgbotCheckin
2015-04-14 13:45hgbotNote Added: 0076525
2015-04-14 13:45hgbotStatusscheduled => resolved
2015-04-14 13:45hgbotResolutionopen => fixed
2015-04-14 13:45hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR15Q2/rev/0fe1fb83dabed14d758b6b1743e27812e388d1b7 [^]
2015-04-14 15:19alostaleAssigned Toplatform => caristu
2015-04-14 18:02AugustoMauchNote Added: 0076535
2015-04-14 18:02AugustoMauchStatusresolved => closed
2015-04-14 18:02AugustoMauchFixed in Version => 3.0PR15Q2

Notes
(0076525)
hgbot   
2015-04-14 13:45   
Repository: erp/backports/3.0PR15Q2
Changeset: 0fe1fb83dabed14d758b6b1743e27812e388d1b7
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Apr 14 13:45:24 2015 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR15Q2/rev/0fe1fb83dabed14d758b6b1743e27812e388d1b7 [^]

fixes issue 29567: onChange event does not work fine
 using Date parameters in Process Definition

There were two different problems:
1) When changing the value manually, the _textChanged attribute was always true after the first change. This prevented the date value to be updated properly. This has been solved by creating a new method, setDateParameterValue, which avoids this problem when setting the date parameter values. The following documentation has been updated with this information: http://wiki.openbravo.com/wiki/How_to_create_a_Standard_Process_Definition#Advanced_Topics [^]
2) When changing the value from the date picker, the onblur event was not being called after the first time. This has been solved by calling the handleItemChange method of the OBParameterWindowForm class after choosing the value from the picker.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
---
(0076535)
AugustoMauch   
2015-04-14 18:02   
Code reviewed and verified in [1]@0fe1fb83dabe

[1] https://code.openbravo.com/erp/backports/3.0PR15Q2 [^]