Chirag Patel (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-577165-cpa into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-577165-cpa/+merge/117022

Hello

Fixed eval gives wrong value when float value eval and decimal separator not 
point.

Demo: Accounting > Periodical Processing > Reconciliation > Manual 
Reconciliation.
1) Select one record from list.
2) Click on action "Reconciliation Entries" from sidebar.

When "Write-Off amount" have some value, not 0.00
Then wizard show 3 buttons "Cancel", "Reconcile With Write-Off" and "partial 
Reconcile".

3) Change the Decimal Separator "." to "," or other from current language.

Observed: Follow above step again, Now wizard have only 2 buttons "Cancel" and 
"Reconcile".
Expected: wizard must be show 3 button "Cancel", "Reconcile With Write-Off" and 
"partial Reconcile".

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-577165-cpa/+merge/117022
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-577165-cpa.
=== modified file 'addons/openerp/static/javascript/form_state.js'
--- addons/openerp/static/javascript/form_state.js	2012-07-19 13:16:48 +0000
+++ addons/openerp/static/javascript/form_state.js	2012-07-27 09:20:31 +0000
@@ -235,11 +235,20 @@
         var elem_value;
         if(elem.is(':input')) {
             elem_kind = elem.attr('kind')
-            if(elem_kind == 'float' || elem_kind == 'integer') {
-                elem_value = eval(elem.val());
-            } else {
-                elem_value = elem.val();
-            }
+            elem_value = elem.val();
+            var patt = /[^0-9]/g;
+            if(elem_kind == 'float'){
+                elem_value = elem_value.replace(patt,'.');
+                decimal_at = elem_value.lastIndexOf('.');
+                first_part = elem_value.substring(0, decimal_at);
+                first_part = first_part.replace(patt,'');
+                second_part = elem_value.substring(decimal_at);
+                elem_value = first_part + second_part;
+            }
+            if(elem_kind == 'integer'){
+                elem_value = elem_value.replace(patt,'');
+            }
+            elem_value = elem.val()[0] == '-' ? ('-' + elem_value) : elem_value;
         } else if(elem[0].nodeName == "TABLE"){
             prefix = $(elem).attr('id')
             elem_value = eval($(idSelector(prefix+"/_terp_ids")).val())

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to