float_time widget incorrect rounding

Reported by Lorenzo Battistini - Agile BG on 2011-11-08
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP GTK Client
Low
OpenERP Publisher's Warranty Team
OpenERP Web
Undecided
Unassigned
OpenERP Web Client
Low
OpenERP Publisher's Warranty Team

Bug Description

openobject-client/6.0 revno 1909

see float_time_convert at
http://bazaar.launchpad.net/~openerp/openobject-client/6.0/view/1911/bin/tools/datetime_util.py#L158

0.9853 is converted to 1 hour while it should be 59 minutes,
because
98.53 : 100 = x : 60
and
98.53 × 60 ÷ 100 = 59.118 ≃ 59 minutes

but GTK client does

>>> round(abs(0.9853)%1+0.01,2)
1.0

Why isn't the proportion implemented?

Changed in openobject-client:
assignee: nobody → OpenERP sa GTK client R&D (openerp-dev-gtk)
importance: Undecided → Low
status: New → Confirmed

The problem here is not the proportion: the multiplication for 60 is done on line 166.

Still, we should figure out why on line 161, we add 0.01 and then round() (as opposed to floor() or not adding 0.01 )

Hello,
please verify the attached patch.
Thanks

summary: - float_time widget wrongly rounds
+ float_time widget incorrect rounding

I'm attaching patch for openobject-client-web

Attaching better patch for GTK

Attaching better patch for web

tags: added: maintenance
Changed in openobject-client:
assignee: OpenERP sa GTK client R&D (openerp-dev-gtk) → OpenERP Publisher's Warranty Team (openerp-opw)
Changed in openobject-client:
status: Confirmed → Fix Committed
Naresh(OpenERP) (nch-openerp) wrote :

Hello Lorenzo Battistini,

Thanks for reporting the bug and providing the patches. Your patch seems fine for both gtk and web but this could also be done with just minimum change we have created a merge proposal with your patch and the modification required for both gtk and weeb version
GTK: lp:~openerp-commiter/openobject-client/6.0-opw-57686-nch
WEB: lp:~openerp-dev/openobject-client-web/6.0-opw-57686-msh

which will be merged soon to the relevant stable versions

Regards,

Changed in openobject-client-web:
status: New → Fix Committed
importance: Undecided → Low
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)

Hello Naresh,
the proposed merge does not work for some values.
Try for instance with 0.0085 which should be rounded to 1 minute.

Naresh(OpenERP) (nch-openerp) wrote :

Hello Lorenzo,

Thanks for your feedback, yes you are right the final round was missing. It has been improved on the proposed merge for GTK can you please have a test now. I have checked for the web client and seems to work perfectly. The problem was only for GTK client.

Regards,

Naresh(OpenERP) (nch-openerp) wrote :

Hello Lorenzo,

The merge proposals has been landed on stable versions at the following revision infos:

gtk: 1923 <email address hidden>
web:4753 <email address hidden>

Regards,

Changed in openobject-client:
status: Fix Committed → Fix Released
Changed in openobject-client-web:
status: Fix Committed → Fix Released
Changed in openobject-client:
milestone: none → 6.0.4
Changed in openobject-client-web:
milestone: none → 6.0.4

This bug affects GTK and Web on 6.1 too

Changed in openobject-client:
status: Fix Released → Confirmed
Changed in openobject-client-web:
status: Fix Released → Confirmed
status: Confirmed → Fix Released
Xavier (Open ERP) (xmo) wrote :

Lorenzo, I tried adding the two edge values you mentioned in this thread to the test suite of OpenERP Web for the float_time widget: http://bazaar.launchpad.net/~openerp/openerp-web/trunk/revision/1963?start_revid=1963

Both passed without having to change any code, I then tried an end-to-end test to ensure there was not an other piece of the system failing, I set the `remaining_hours` value of two project.task objects to respectively 0.9853 and 0.0085 to check that they correctly displayed as `00:59` and `00:01`, see screenshot.

Marking bug as invalid for OpenERP Web, don't hesitate reopening it if you have values on which OpenERP Web fails.

Changed in openerp-web:
status: New → Invalid
Xavier (Open ERP) (xmo) wrote :

screenshot of project.task visualization in list view, with correct display for remaining_hours with values 0.0085 and 0.9853

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers