Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajoralways2015-10-20 14:292016-01-25 19:02
ReportermalsasuaView Statuspublic 
Assigned Toinigosanchez 
PriorityhighResolutionno change requiredFixed in Version
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_18
OS VersionCommunity ApplianceDatabase version8.3.9Ant version1.7.1
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0031189: on change function is not working fine when the event is triggered by "TAB" key

Descriptionin "on change" function, when the function recalculates one field value, if the event is triggered by the TAB key, the textualValue is wrong calculated. In the example attached (sample.txt), in the part of:

standardPrice: 14.285714285714286
standardPrice_textualValue: "11.43"

the correct value is 14.2857... and the textualValue is the old value.

If the function is triggered by mouse event, then it works fine:
standardPrice: 14.29
standardPrice_textualValue: "14.29"
Steps To ReproduceCreate a callout in client side (as attached file):
- Copy callout2 file at the end of ob-onchange-functions.js file.
- Login as "Openbravo Admin".
- Go to "Windows, Tabs and Fields" window and select "Price List" window.
- Select "Product Price" tab and go to "Field" subtab.
- Edit in form "Price Limit" field:
- Check "Displayed" and "Show in Grid View" checkbox for testing later.
- Also updated "On Change Function" field with following text: OB.OnChange.calcularpreciodia.
- Save the new configuration of "Price Limit" field.
- Logout and Compile.

- Login with "F&B Internation Admin Group".
- Go to "Price List" window and select "Tarifa de Ventas" record.
- Navigate to "Product price" subtab.
- Edit in grid any record and change "Unit Price" value to 2 and "List Price" value to 4.
- Change "Price Limit" value to 3 and change the focus with the mouse or TAB key. Note than "Unit Price" is changed to 4.
- Save the record and note than value in "Unit Price" is wrong because it is the old value.

NOTE: This issue can be reproduced in grid and form view. Also it can be reproduced with Mouse/Tab key event too.
TagsNo tags attached.
Attached Filestxt file icon sample.txt [^] (1,113 bytes) 2015-10-20 14:29 [Show Content]
txt file icon callout.txt [^] (159 bytes) 2015-10-22 08:31 [Show Content]
txt file icon callout2.txt [^] (159 bytes) 2015-11-09 10:42 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to design defect 0031404 closedcaristu setItemValue() function should be update "_textualValue" too 
related to defect 0031901 closedcaristu decimal value can't be changed by trigger/observer after manual edition in form view 

-  Notes
inigosanchez (developer)
2015-11-09 10:43

First of all, note than the problem is reproduce with TAB key but also it is reproduced when the focus is changed with the mouse (click in another field). This problem was reproduced in grid and form view.

For update or recalculate one field value in "onChangeFunction" it is also necessary to update the "_textualValue" value. For this reason it is important to add this code to the "callout" that it was attached:

OB.OnChange.calcularpreciodia = function(item, view, form, grid) {
    var lp = form.getItem('listPrice');
    form.setItemValue('standardPrice', lp.getValue());
    form.setTextualValue('standardPrice', OB.Utilities.Number.OBPlainToOBMasked(lp.getValue(), lp.typeInstance.maskNumeric, lp.typeInstance.decSeparator, lp.typeInstance.groupSeparator, OB.Format.defaultGroupingSize), lp.typeInstance)

It has been resolved the problem with this new callout. It has been tested in grid/form and Tab/Mouse event. Also it has been created a new design defect to improve this issue. See related issue 31404.
caristu (developer)
2016-01-25 19:02

With the fix of 0031901 setTextualValue() is no longer needed to set values on client side callouts.

- Issue History
Date Modified Username Field Change
2015-10-20 14:29 malsasua New Issue
2015-10-20 14:29 malsasua Assigned To => platform
2015-10-20 14:29 malsasua File Added: sample.txt
2015-10-20 14:29 malsasua Modules => Core
2015-10-20 14:29 malsasua Resolution time => 1447887600
2015-10-20 14:29 malsasua Triggers an Emergency Pack => No
2015-10-20 16:24 malsasua File Added: function.txt
2015-10-20 16:25 malsasua Steps to Reproduce Updated View Revisions
2015-10-21 11:48 alostale Status new => scheduled
2015-10-21 11:48 alostale Assigned To platform => inigosanchez
2015-10-22 08:29 malsasua Steps to Reproduce Updated View Revisions
2015-10-22 08:30 malsasua File Deleted: function.txt
2015-10-22 08:31 malsasua File Added: callout.txt
2015-10-22 08:31 malsasua Steps to Reproduce Updated View Revisions
2015-11-09 10:39 inigosanchez Relationship added related to 0031404
2015-11-09 10:40 inigosanchez Steps to Reproduce Updated View Revisions
2015-11-09 10:42 inigosanchez File Added: callout2.txt
2015-11-09 10:43 inigosanchez Review Assigned To => alostale
2015-11-09 10:43 inigosanchez Note Added: 0081613
2015-11-09 10:43 inigosanchez Status scheduled => closed
2015-11-09 10:43 inigosanchez Resolution open => no change required
2016-01-19 11:10 alostale Relationship added related to 0031901
2016-01-25 19:02 caristu Note Added: 0083596

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker