Round cost_price to the correct number of digits

This commit is contained in:
Sergi Almacellas Abellana 2015-07-29 17:13:33 +02:00
parent 20149a69bc
commit 9b17e8f37a
1 changed files with 2 additions and 0 deletions

View File

@ -100,6 +100,8 @@ class SaleLine:
res = super(SaleLine, self).on_change_product()
if self.product:
res['cost_price'] = self.product.cost_price
res['cost_price'] = res['cost_price'].quantize(
Decimal(1) / 10 ** self.__class__.cost_price.digits[1])
return res
@fields.depends('type', 'quantity', 'cost_price', '_parent_sale.currency',