2013/7/17 Cédric Krier <[email protected]> > On 17/07/13 09:24 +0200, Guillem Barba Domingo wrote: > > You can see an example in test0050uom_compute_price() [1] > > The error is that, as well as in compute_qty() the 'factor' of 'from_uom' > > is multiplied [2], in compute_price() it is divided [3]. The same for > > 'rate' fields and 'to_uom' param. > > > > As the error is only in one method, the solution of simply swap the > > parameter names (to mantain positional params) don't make sense, so the > > method and tests must to be fixed and changed all modules that use it. > > There is no mistake in this method. > It is perfectly normal that it does a different computation as > compute_qty (otherwise there will not be 2 methods). > The unittest must be read like this: > > If the price is 100 per Kilogram, what is the price per Gram? 0.1. >
Ok. I was confused with this method. A docstring with this explanation would be good. It should be useful to have a 'compute_qty()' method compatible with Decimal quantities. -- Guillem Barba http://www.guillem.alcarrer.net
