summaryrefslogtreecommitdiff
path: root/addons/sale_management
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-06-15 15:16:16 +0200
committerMartin Trigaux <mat@odoo.com>2020-06-18 13:03:34 +0200
commit80e97e98ce76067db1079af8feeef667cfadf837 (patch)
treee261d34e3f8458bd99011f60f508bcce2c723baf /addons/sale_management
parent4a92a183e8631512a8b018eedaf9bf4956ca85e9 (diff)
[IMP] *: use named placeholders in translated message
When more than one parameter is present in a message, it helps the translation to use named placeholder. This way, the order can be changed. It also helps the comprehension of the message.
Diffstat (limited to 'addons/sale_management')
-rw-r--r--addons/sale_management/models/sale_order.py7
-rw-r--r--addons/sale_management/models/sale_order_template.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/addons/sale_management/models/sale_order.py b/addons/sale_management/models/sale_order.py
index 04a9e87128a..f2ea0512f8b 100644
--- a/addons/sale_management/models/sale_order.py
+++ b/addons/sale_management/models/sale_order.py
@@ -35,7 +35,12 @@ class SaleOrder(models.Model):
companies = order.sale_order_option_ids.product_id.company_id
if companies and companies != order.company_id:
bad_products = order.sale_order_option_ids.product_id.filtered(lambda p: p.company_id and p.company_id != order.company_id)
- raise ValidationError((_("Your quotation contains products from company %s whereas your quotation belongs to company %s. \n Please change the company of your quotation or remove the products from other companies (%s).") % (', '.join(companies.mapped('display_name')), order.company_id.display_name, ', '.join(bad_products.mapped('display_name')))))
+ raise ValidationError(_(
+ "Your quotation contains products from company %(product_company)s whereas your quotation belongs to company %(quote_company)s. \n Please change the company of your quotation or remove the products from other companies (%(bad_products)s).",
+ product_company=', '.join(companies.mapped('display_name')),
+ quote_company=order.company_id.display_name,
+ bad_products=', '.join(bad_products.mapped('display_name')),
+ ))
@api.returns('self', lambda value: value.id)
def copy(self, default=None):
diff --git a/addons/sale_management/models/sale_order_template.py b/addons/sale_management/models/sale_order_template.py
index 5eaed0176f0..0552938bde3 100644
--- a/addons/sale_management/models/sale_order_template.py
+++ b/addons/sale_management/models/sale_order_template.py
@@ -37,7 +37,11 @@ class SaleOrderTemplate(models.Model):
if len(companies) > 1:
raise ValidationError(_("Your template cannot contain products from multiple companies."))
elif companies and companies != template.company_id:
- raise ValidationError((_("Your template contains products from company %s whereas your template belongs to company %s. \n Please change the company of your template or remove the products from other companies.") % (companies.mapped('display_name'), template.company_id.display_name)))
+ raise ValidationError(_(
+ "Your template contains products from company %(product_company)s whereas your template belongs to company %(template_company)s. \n Please change the company of your template or remove the products from other companies.",
+ product_company=', '.join(companies.mapped('display_name')),
+ template_company=template.company_id.display_name,
+ ))
@api.onchange('sale_order_template_line_ids', 'sale_order_template_option_ids')
def _onchange_template_line_ids(self):