mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] mrp_bom_attribute_match: properly translate strings
This commit is contained in:
@@ -69,7 +69,8 @@ class MrpBomLine(models.Model):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"No match on attribute has been detected for Component "
|
||||
"(Product Template) %s" % self.component_template_id.display_name
|
||||
"(Product Template) %s",
|
||||
self.component_template_id.display_name,
|
||||
)
|
||||
)
|
||||
if not all(item in prod_attr_ids for item in comp_attr_ids):
|
||||
@@ -96,16 +97,15 @@ class MrpBomLine(models.Model):
|
||||
)
|
||||
same_attrs = set(self.match_on_attribute_ids.ids) & set(variant_attr_ids.ids)
|
||||
if len(same_attrs) > 0:
|
||||
attr_recs = self.env["product.attribute"].browse(same_attrs)
|
||||
raise ValidationError(
|
||||
_(
|
||||
"You cannot use an attribute value for attribute"
|
||||
" %s in the field “Apply on Variants” as it’s the"
|
||||
" same attribute used in field “Match on Attribute”"
|
||||
"related to the component %s."
|
||||
% (
|
||||
self.env["product.attribute"].browse(same_attrs),
|
||||
self.component_template_id.name,
|
||||
)
|
||||
"You cannot use an attribute value for attribute(s) %(attributes)s "
|
||||
"in the field “Apply on Variants” as it's the same attribute used "
|
||||
"in the field “Match on Attribute” related to the component "
|
||||
"%(component)s.",
|
||||
attributes=", ".join(attr_recs.mapped("name")),
|
||||
component=self.component_template_id.name,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -26,11 +26,13 @@ class ProductTemplate(models.Model):
|
||||
attr_recs = self.env["product.attribute"].browse(diff)
|
||||
raise UserError(
|
||||
_(
|
||||
"The attributes you're trying to remove is used in BoM "
|
||||
"as a match with Component (Product Template). To "
|
||||
"remove these attributes, first remove the BOM line "
|
||||
"with the matching component.\nAttributes: %s\nBoM: %s"
|
||||
% (attr_recs.mapped("name"), bom.display_name)
|
||||
"The attributes you're trying to remove are used in "
|
||||
"the BoM as a match with Component (Product Template). "
|
||||
"To remove these attributes, first remove the BOM line "
|
||||
"with the matching component.\n"
|
||||
"Attributes: %(attributes)s\nBoM: %(bom)s",
|
||||
attributes=", ".join(attr_recs.mapped("name")),
|
||||
bom=bom.display_name,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -48,13 +50,11 @@ class ProductTemplate(models.Model):
|
||||
raise UserError(
|
||||
_(
|
||||
"This product template is used as a component in the "
|
||||
"BOMs for %s and attribute(s) %s is not present in all "
|
||||
"such product(s), and this would break the BOM "
|
||||
"behavior."
|
||||
% (
|
||||
bom.display_name,
|
||||
attr_recs.mapped("name"),
|
||||
)
|
||||
"BOMs for %(bom)s and attribute(s) %(attributes)s is "
|
||||
"not present in all such product(s), and this would "
|
||||
"break the BOM behavior.",
|
||||
attributes=", ".join(attr_recs.mapped("name")),
|
||||
bom=bom.display_name,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user