[FIX] stock_account: raise an error if the valuation_amount is zero, to avoid wrong configurations.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user