summaryrefslogtreecommitdiff
path: root/addons/sale_coupon
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-07-22 16:52:13 +0000
committerVictor Feyens <vfe@odoo.com>2020-07-23 12:13:19 +0000
commite8893f84abcc50dfdfd3173497f388e94310f090 (patch)
treee33136b3d2dee7bffebdc2be743f4f6a15099407 /addons/sale_coupon
parentb932ea75fec28052d8bc262c590171dfa97ef4e9 (diff)
[IMP] *: translations improvements
Avoid concatenation of translated strings & raw values and/or other translated values, and use the new _ API (by providing the formatting values to ensure the fallback on the english terms in case of wrong translation). By including the expected values inside the string to translate, we ensure that the formatted values are included at the right place in the resulting translated text. This also provides more information on the string to translate to the translators, s.t. the chosen terms for the translations can be more adapted to the translation context. closes odoo/odoo#54635 Related: odoo/enterprise#11925 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'addons/sale_coupon')
-rw-r--r--addons/sale_coupon/models/sale_order.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/addons/sale_coupon/models/sale_order.py b/addons/sale_coupon/models/sale_order.py
index fd979d0524b..73e08c87d55 100644
--- a/addons/sale_coupon/models/sale_order.py
+++ b/addons/sale_coupon/models/sale_order.py
@@ -132,7 +132,7 @@ class SaleOrder(models.Model):
def _get_reward_values_discount(self, program):
if program.discount_type == 'fixed_amount':
return [{
- 'name': _("Discount: ") + program.name,
+ 'name': _("Discount: %s", program.name),
'product_id': program.discount_line_product_id.id,
'price_unit': - self._get_reward_values_discount_fixed_amount(program),
'product_uom_qty': 1.0,
@@ -150,7 +150,7 @@ class SaleOrder(models.Model):
taxes = self.fiscal_position_id.map_tax(line.tax_id)
reward_dict[line.tax_id] = {
- 'name': _("Discount: ") + program.name,
+ 'name': _("Discount: %s", program.name),
'product_id': program.discount_line_product_id.id,
'price_unit': - discount_line_amount,
'product_uom_qty': 1.0,
@@ -174,14 +174,12 @@ class SaleOrder(models.Model):
else:
taxes = self.fiscal_position_id.map_tax(line.tax_id)
- tax_name = ""
- if len(taxes) == 1:
- tax_name = " - " + _("On product with following tax: ") + ', '.join(taxes.mapped('name'))
- elif len(taxes) > 1:
- tax_name = " - " + _("On product with following taxes: ") + ', '.join(taxes.mapped('name'))
-
reward_dict[line.tax_id] = {
- 'name': _("Discount: ") + program.name + tax_name,
+ 'name': _(
+ "Discount: %(program)s - On product with following taxes: %(taxes)s",
+ program=program.name,
+ taxes=", ".join(taxes.mapped('name')),
+ ),
'product_id': program.discount_line_product_id.id,
'price_unit': - discount_line_amount,
'product_uom_qty': 1.0,