summaryrefslogtreecommitdiff
path: root/addons/coupon
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-06-26 07:21:33 +0000
committerMartin Trigaux <mat@odoo.com>2020-06-30 10:19:59 +0000
commit400cc4f14ed12bce8d11ea515041253a9271f5a5 (patch)
treee62f8e54acf97e42325114844494b4b82fc99a07 /addons/coupon
parent241f06d868296f6e2ef851d6f5d156f59f630b00 (diff)
[FIX] *: correct all or improve code translation lookup
This commit fixes all issues detected by the new pylint gettext-variable test. It converts some calls to the new syntax _("Foo %s", bar) to progressively migrate the code to the new syntax. A few calls were not technically incorrect but still detected by the linter. _("Foo" + "Bar") has been converted to _("Foo" "Bar") as it has the same effect and make sure the argument is of type asteroid.Const instead of BinOp). closes odoo/odoo#53683 Related: odoo/enterprise#11467 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/coupon')
-rw-r--r--addons/coupon/models/coupon_reward.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/addons/coupon/models/coupon_reward.py b/addons/coupon/models/coupon_reward.py
index 12bc1525b9f..99dfc1798ed 100644
--- a/addons/coupon/models/coupon_reward.py
+++ b/addons/coupon/models/coupon_reward.py
@@ -64,21 +64,29 @@ class CouponReward(models.Model):
for reward in self:
reward_string = ""
if reward.reward_type == 'product':
- reward_string = _("Free Product - %s" % (reward.reward_product_id.name))
+ reward_string = _("Free Product - %s", reward.reward_product_id.name)
elif reward.reward_type == 'discount':
if reward.discount_type == 'percentage':
reward_percentage = str(reward.discount_percentage)
if reward.discount_apply_on == 'on_order':
- reward_string = _("%s%% discount on total amount" % (reward_percentage))
+ reward_string = _("%s%% discount on total amount", reward_percentage)
elif reward.discount_apply_on == 'specific_products':
if len(reward.discount_specific_product_ids) > 1:
- reward_string = _("%s%% discount on products" % (reward_percentage))
+ reward_string = _("%s%% discount on products", reward_percentage)
else:
- reward_string = _("%s%% discount on %s" % (reward_percentage, reward.discount_specific_product_ids.name))
+ reward_string = _(
+ "%(percentage)s%% discount on %(product_name)s",
+ percentage=reward_percentage,
+ product_name=reward.discount_specific_product_ids.name
+ )
elif reward.discount_apply_on == 'cheapest_product':
- reward_string = _("%s%% discount on cheapest product" % (reward_percentage))
+ reward_string = _("%s%% discount on cheapest product", reward_percentage)
elif reward.discount_type == 'fixed_amount':
program = self.env['coupon.program'].search([('reward_id', '=', reward.id)])
- reward_string = _("%s %s discount on total amount" % (str(reward.discount_fixed_amount), program.currency_id.name))
+ reward_string = _(
+ "%(amount)s %(currency)s discount on total amount",
+ amount=reward.discount_fixed_amount,
+ currency=program.currency_id.name
+ )
result.append((reward.id, reward_string))
return result