Issue 10180

Title
Ensure currency's rounding is greater than zero
Priority
bug
Status
testing
Nosy list
albertca, ced, reviewbot
Assigned to
albertca
Keywords
review

Created on 2021-03-11.00:18:53 by albertca, last changed 1 month ago by ced.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-11.10:05:02
On 2021-03-11 00:39, Albert Cervera i Areny wrote:
> The problem appears also in _round():
> 
> https://hg.tryton.org/modules/currency/file/tip/currency.py#l160

I do not understand.

> As it is called with self.rounding as factor:
> 
> https://hg.tryton.org/modules/currency/file/tip/currency.py#l155
> 
> And if rounding is zero it crashes with a division by zero.

It should be fixed by disabling the rounding. If the minimum amount of a
currency is 0, then any value is valid.
Author: [hidden] (albertca) Tryton committer
Date: 2021-03-11.00:39:09

The problem appears also in _round():

https://hg.tryton.org/modules/currency/file/tip/currency.py#l160

As it is called with self.rounding as factor:

https://hg.tryton.org/modules/currency/file/tip/currency.py#l155

And if rounding is zero it crashes with a division by zero.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-03-11.00:26:07

Would it not be less intrusive to use absolute value in is_zero. For me it is the only place where it fails.
Also this would allow to backport it as for me there is a bug.

Author: [hidden] (albertca) Tryton committer
Date: 2021-03-11.00:18:53

Rounding field in currencies should have a domain that ensure that it is > 0.

History
Date User Action Args
2021-03-11 10:05:02cedsetmessages: + msg65351
2021-03-11 00:39:42reviewbotsetmessages: + msg65347
nosy: + reviewbot
2021-03-11 00:39:09albertcasetmessages: + msg65346
2021-03-11 00:26:07cedsetmessages: + msg65345
nosy: + ced
priority: feature -> bug
type: feature request -> behavior
2021-03-11 00:22:08albertcasetstatus: unread -> testing
2021-03-11 00:22:02albertcasetkeyword: + review
reviews: 359291004
2021-03-11 00:18:53albertcacreate

Showing 10 items. Show all history (warning: this could be VERY long)