[Fix] stock_account: detect if there is no price change

The warning tells the user that there is no difference between the standard
price and new price, while the if condition does the exact opposite.

Closes #13797
Fixes #13785
This commit is contained in:
Yenthe V.G
2016-10-14 11:56:18 +02:00
committed by Martin Trigaux
parent 2054337199
commit 5421beafb1
+2 -1
View File
@@ -3,6 +3,7 @@
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
class ProductTemplate(models.Model):
@@ -105,7 +106,7 @@ class ProductProduct(models.Model):
for location in locations:
for product in self.with_context(location=location.id, compute_child=False):
diff = product.standard_price - new_price
if diff:
if float_is_zero(diff, precision_rounding=product.currency_id.rounding):
raise UserError(_("No difference between standard price and new price!"))
if not product_accounts[product.id].get('stock_valuation', False):
raise UserError(_('You don\'t have any stock valuation account defined on your product category. You must define one before processing this operation.'))