Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029544Openbravo ERPA. Platformpublic2015-04-09 10:452015-05-07 22:16
umartirena 
caristu 
immediateminoralways
closedfixed 
5
 
pi 
AugustoMauch
Core
No
0029544: 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.
depends on backport 00295673.0PR15Q2 closed caristu onChange event does not work fine using Date parameters in Process Definition 
depends on backport 00295683.0PR15Q1.3 closed caristu onChange event does not work fine using Date parameters in Process Definition 
related to defect 0027240 closed caristu On Change Function does not take effect in not editable fields in Process Definition windows 
blocks defect 0029534 closed umartirena Accounting Date is not updated when changing Transaction Date in Transaction tab under Financial Account 
Issue History
2015-04-09 10:45umartirenaNew Issue
2015-04-09 10:45umartirenaAssigned To => platform
2015-04-09 10:45umartirenaModules => Core
2015-04-09 10:45umartirenaTriggers an Emergency Pack => No
2015-04-09 16:44umartirenaRelationship addedblocks 0029534
2015-04-10 13:22alostaleNote Added: 0076445
2015-04-10 13:22alostalePriorityhigh => immediate
2015-04-10 13:22alostaleStatusnew => acknowledged
2015-04-13 08:48alostaleStatusacknowledged => scheduled
2015-04-13 08:48alostaleAssigned Toplatform => caristu
2015-04-13 14:04caristuNote Added: 0076478
2015-04-14 12:20caristuIssue Monitored: alostale
2015-04-14 12:20caristuReview Assigned To => alostale
2015-04-14 12:21hgbotCheckin
2015-04-14 12:21hgbotNote Added: 0076517
2015-04-14 12:21hgbotStatusscheduled => resolved
2015-04-14 12:21hgbotResolutionopen => fixed
2015-04-14 12:21hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5368a8d1c9bb28a8b1b6b0740b057c46aca6a312 [^]
2015-04-14 12:46caristuNote Added: 0076520
2015-04-14 15:18alostaleReview Assigned Toalostale => AugustoMauch
2015-04-14 18:29AugustoMauchNote Added: 0076538
2015-04-14 18:29AugustoMauchStatusresolved => closed
2015-04-14 18:29AugustoMauchFixed in Version => pi
2015-05-07 22:16hudsonbotCheckin
2015-05-07 22:16hudsonbotNote Added: 0077124
2015-12-02 10:42caristuRelationship addedrelated to 0027240

Notes
(0076445)
alostale   
2015-04-10 13:22   
upgrading to immediate as it blocks a regression
(0076478)
caristu   
2015-04-13 14:04   
There are two different problems:

  1) When changing the value manually, the _textChanged attribute is always true after the first change. This prevents the date value to be updated properly. This can be solved by creating a new method to be invoked from the onchange function. It will be executed the same actions as the setValue() method but it will also clean the _textChanged attribute.

 2) When changing the value from the date picker, the onblur event is not being called after the first time. This causes that the onchange function is never fired.
(0076517)
hgbot   
2015-04-14 12:21   
Repository: erp/devel/pi
Changeset: 5368a8d1c9bb28a8b1b6b0740b057c46aca6a312
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Apr 14 12:19:17 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5368a8d1c9bb28a8b1b6b0740b057c46aca6a312 [^]

fixes issue 29544: 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
---
(0076520)
caristu   
2015-04-14 12:46   
The documentation has been update to include new function available for setting the value of a date parameter: http://wiki.openbravo.com/wiki/How_to_create_a_Standard_Process_Definition#How_to_set_the_value_of_a_date_parameter_programatically [^]
(0076538)
AugustoMauch   
2015-04-14 18:29   
Code reviewed and verified in pi@c05d9da39c58
(0077124)
hudsonbot   
2015-05-07 22:16   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/a1817f84bd8b [^]
Maturity status: Test