Reviewers: ,
Please review this at http://codereview.tryton.org/222001/ Affected files: M product.py Index: product.py =================================================================== --- a/product.py +++ b/product.py @@ -169,6 +169,7 @@ and quantity as value """ pool = Pool() + uom_obj = pool.get('product.uom') rule_obj = pool.get('ir.rule') location_obj = pool.get('stock.location') date_obj = pool.get('ir.date') @@ -493,6 +494,14 @@ if location not in location_ids: del res[(location, product)] + # Round quantities + default_uom = dict((p.id, p.default_uom) for p in + self.browse(res_product_ids)) + for key, quantity in res.itertimes(): + location, product = key + uom = default_uom[product] + res[key] = uom_obj.round(quantity, uom.rounding) + # Complete result with missing products if asked if not skip_zero: # Search for all products, even if not linked with moves -- [email protected] mailing list
