From ddbe0e18f35773d308a29bf6baacf921982bb15b Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 14 Oct 2015 17:33:50 +0200 Subject: [PATCH] [FIX] stock_account: raise an error if the valuation_amount is zero, to avoid wrong configurations. --- addons/stock_account/stock_account.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index 0628d23604f..0cf01628a92 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -292,6 +292,8 @@ class stock_quant(osv.osv): #the standard_price of the product may be in another decimal precision, or not compatible with the coinage of #the company currency... so we need to use round() before creating the accounting entries. valuation_amount = currency_obj.round(cr, uid, move.company_id.currency_id, valuation_amount * qty) + if move.company_id.currency_id.is_zero(valuation_amount): + raise UserError(_("The found valuation amount for product %s is zero. Which means there is probably a configuration error. Check the costing method and the standard price") % (move.product_id.name,)) partner_id = (move.picking_id.partner_id and self.pool.get('res.partner')._find_accounting_partner(move.picking_id.partner_id).id) or False debit_line_vals = { 'name': move.name,