Mohammed Shekha(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-client-web/6.0-opw-57686-msh into 
lp:openobject-client-web.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #887612 in OpenERP Web Client: "float_time widget incorrect rounding"
  https://bugs.launchpad.net/openobject-client-web/+bug/887612

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-57686-msh/+merge/87729

Hello,

Fixed the issue of floattime widget which is not storing proper float amount.

Demo :- Goto project -> Task -> Create Task with some amount of time -> Start 
Task -> Create "Task Work" line and insert Time Spent Value as 0.9853 and save 
the record.

The Time Spent will changed to 1:00 hour instead of 00:59 minutes because 
0.9853 * 60 = 59.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-57686-msh/+merge/87729
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-client-web/6.0-opw-57686-msh.
=== modified file 'addons/openerp/validators.py'
--- addons/openerp/validators.py	2011-01-17 11:57:11 +0000
+++ addons/openerp/validators.py	2012-01-06 11:43:26 +0000
@@ -81,7 +81,7 @@
 
     def _from_python(self, value, state):
         val = value or 0.0
-        t = '%02d:%02d' % (math.floor(abs(val)),round(abs(val)%1+0.01,2) * 60)
+        t = '%02d:%02d' % (math.floor(abs(val)),round(round(abs(val)%1,2) * 60))
         if val < 0:
             t = '-' + t
         return t

=== modified file 'addons/openerp/widgets/listgrid.py'
--- addons/openerp/widgets/listgrid.py	2011-09-28 10:35:28 +0000
+++ addons/openerp/widgets/listgrid.py	2012-01-06 11:43:26 +0000
@@ -526,8 +526,8 @@
 
     def get_text(self):
         val = self.value or 0.0
-        t = '%02d:%02d' % (math.floor(abs(val)),round(abs(val)%1+0.01,2) * 60)
-        
+        t = '%02d:%02d' % (math.floor(abs(val)),round(round(abs(val)%1,2) * 60))
+
         hour, min = t.split(':')
         if int(min) == 60:
             t = str(int(hour) + 1) + ":00"

_______________________________________________
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