float_time widget incorrect rounding

Bug #887612 reported by Lorenzo Battistini
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
Confirmed
Low
OpenERP Publisher's Warranty Team
Odoo Web (MOVED TO GITHUB)
Invalid
Undecided
Unassigned
Odoo Web Client
Fix Released
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?

Tags: maintenance

Related branches

Changed in openobject-client:
assignee: nobody → OpenERP sa GTK client R&D (openerp-dev-gtk)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Leonardo Pistone (lepistone) wrote :

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 )

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Hello,
please verify the attached patch.
Thanks

summary: - float_time widget wrongly rounds
+ float_time widget incorrect rounding
Revision history for this message
Lorenzo Battistini (elbati) wrote :

I'm attaching patch for openobject-client-web

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Attaching better patch for GTK

Revision history for this message
Lorenzo Battistini (elbati) wrote :

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
Revision history for this message
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)
Revision history for this message
Lorenzo Battistini (elbati) wrote :

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

Revision history for this message
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,

Revision history for this message
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
Revision history for this message
Lorenzo Battistini (elbati) wrote :

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
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) 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
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) 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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.