[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:
@@ -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.'))
|
||||
|
||||
Reference in New Issue
Block a user