[REF] stock,uom: error message more clear

Change to more understable error messages

TASK-1841502
This commit is contained in:
Hetashree Chauhan
2018-06-18 16:49:16 +02:00
committed by Pierre Masereel
parent 9f84707653
commit 06a804596e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -509,7 +509,7 @@ class ProductTemplate(models.Model):
updated = self.filtered(lambda template: template.uom_id != new_uom)
done_moves = self.env['stock.move'].search([('product_id', 'in', updated.with_context(active_test=False).mapped('product_variant_ids').ids)], limit=1)
if done_moves:
raise UserError(_("You can not change the unit of measure of a product that has already been used in a done stock move. If you need to change the unit of measure, you may deactivate this product."))
raise UserError(_("You cannot change the unit of measure as there are already stock moves for this product. If you want to change the unit of measure, you should rather archive this product and create a new one."))
if 'type' in vals and vals['type'] != 'product' and sum(self.mapped('nbr_reordering_rules')) != 0:
raise UserError(_('You still have some active reordering rules on this product. Please archive or delete them first.'))
if any('type' in vals and vals['type'] != prod_tmpl.type for prod_tmpl in self):
+1 -1
View File
@@ -135,7 +135,7 @@ class UoM(models.Model):
self.ensure_one()
if self.category_id.id != to_unit.category_id.id:
if raise_if_failure:
raise UserError(_('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (self.name, to_unit.name))
raise UserError(_('The unit of measure %s defined on the order line doesn\'t belong to the same category than the unit of measure %s defined on the product. Please correct the unit of measure defined on the order line or on the product, they should belong to the same category.') % (self.name, to_unit.name))
else:
return qty
amount = qty / self.factor