From f8ff7debdc86ee910af881be82f7b67201bcd791 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 1 Mar 2019 14:56:19 +0000 Subject: [PATCH] [FIX] *: bad usage of _ method No need for selection fields If in global variable, the _lt should be used instead closes odoo/odoo#31211 Signed-off-by: Martin Trigaux (mat) --- .../account/models/account_reconcile_model.py | 6 +++--- addons/account/models/chart_template.py | 6 +++--- addons/hr_skills/models/hr_skills.py | 2 +- addons/l10n_fr_pos_cert/models/pos.py | 4 ++-- addons/sale/models/payment.py | 4 ++-- .../models/res_config_settings.py | 20 +++++++++---------- odoo/addons/base/models/res_partner.py | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index af21f257f14..c9d45548482 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -16,9 +16,9 @@ class AccountReconcileModel(models.Model): company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.company) rule_type = fields.Selection(selection=[ - ('writeoff_button', _('Manually create a write-off on clicked button.')), - ('writeoff_suggestion', _('Suggest counterpart values.')), - ('invoice_matching', _('Match existing invoices/bills.')) + ('writeoff_button', 'Manually create a write-off on clicked button.'), + ('writeoff_suggestion', 'Suggest counterpart values.'), + ('invoice_matching', 'Match existing invoices/bills.') ], string='Type', default='writeoff_button', required=True) auto_reconcile = fields.Boolean(string='Auto-validate', help='Validate the statement line automatically (reconciliation based on your rule).') diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index 025394dbe69..94c63d9de70 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -1066,9 +1066,9 @@ class AccountReconcileModelTemplate(models.Model): sequence = fields.Integer(required=True, default=10) rule_type = fields.Selection(selection=[ - ('writeoff_button', _('Manually create a write-off on clicked button.')), - ('writeoff_suggestion', _('Suggest a write-off.')), - ('invoice_matching', _('Match existing invoices/bills.')) + ('writeoff_button', 'Manually create a write-off on clicked button.'), + ('writeoff_suggestion', 'Suggest a write-off.'), + ('invoice_matching', 'Match existing invoices/bills.') ], string='Type', default='writeoff_button', required=True) auto_reconcile = fields.Boolean(string='Auto-validate', help='Validate the statement line automatically (reconciliation based on your rule).') diff --git a/addons/hr_skills/models/hr_skills.py b/addons/hr_skills/models/hr_skills.py index 4eeb950a71b..28426330903 100644 --- a/addons/hr_skills/models/hr_skills.py +++ b/addons/hr_skills/models/hr_skills.py @@ -26,7 +26,7 @@ class EmployeeSkill(models.Model): level_progress = fields.Integer(related='skill_level_id.level_progress') _sql_constraints = [ - ('_unique_skill', 'unique (employee_id, skill_id)', _("Two levels for the same skill is not allowed")), + ('_unique_skill', 'unique (employee_id, skill_id)', "Two levels for the same skill is not allowed"), ] @api.constrains('skill_id', 'skill_type_id') diff --git a/addons/l10n_fr_pos_cert/models/pos.py b/addons/l10n_fr_pos_cert/models/pos.py index 7278b9c9c64..227d2f81a3d 100644 --- a/addons/l10n_fr_pos_cert/models/pos.py +++ b/addons/l10n_fr_pos_cert/models/pos.py @@ -7,7 +7,7 @@ import pytz from odoo import models, api, fields from odoo.fields import Datetime -from odoo.tools.translate import _ +from odoo.tools.translate import _, _lt from odoo.exceptions import UserError @@ -53,7 +53,7 @@ class pos_session(models.Model): ORDER_FIELDS = ['date_order', 'user_id', 'lines', 'statement_ids', 'pricelist_id', 'partner_id', 'session_id', 'pos_reference', 'sale_journal', 'fiscal_position_id'] LINE_FIELDS = ['notice', 'product_id', 'qty', 'price_unit', 'discount', 'tax_ids', 'tax_ids_after_fiscal_position'] -ERR_MSG = _('According to the French law, you cannot modify a %s. Forbidden fields: %s.') +ERR_MSG = _lt('According to the French law, you cannot modify a %s. Forbidden fields: %s.') class pos_order(models.Model): diff --git a/addons/sale/models/payment.py b/addons/sale/models/payment.py index 45dc251372a..dc991441c2a 100644 --- a/addons/sale/models/payment.py +++ b/addons/sale/models/payment.py @@ -10,8 +10,8 @@ class PaymentAcquirer(models.Model): so_reference_type = fields.Selection(string='Communication', selection=[ - ('so_name', _('Based on Document Reference')), - ('partner', _('Based on Customer ID'))], default='so_name', + ('so_name', 'Based on Document Reference'), + ('partner', 'Based on Customer ID')], default='so_name', help='You can set here the communication type that will appear on sales orders.' 'The communication will be given to the customer when they choose the payment method.') diff --git a/addons/website_twitter/models/res_config_settings.py b/addons/website_twitter/models/res_config_settings.py index b0e70529313..b590f379ec1 100644 --- a/addons/website_twitter/models/res_config_settings.py +++ b/addons/website_twitter/models/res_config_settings.py @@ -5,21 +5,21 @@ import logging import requests -from odoo import api, fields, models, _ +from odoo import api, fields, models, _, _lt from odoo.exceptions import UserError _logger = logging.getLogger(__name__) TWITTER_EXCEPTION = { - 304: _('There was no new data to return.'), - 400: _('The request was invalid or cannot be otherwise served. Requests without authentication are considered invalid and will yield this response.'), - 401: _('Authentication credentials were missing or incorrect. Maybe screen name tweets are protected.'), - 403: _('The request is understood, but it has been refused or access is not allowed. Please check your Twitter API Key and Secret.'), - 429: _('Request cannot be served due to the applications rate limit having been exhausted for the resource.'), - 500: _('Twitter seems broken. Please retry later. You may consider posting an issue on Twitter forums to get help.'), - 502: _('Twitter is down or being upgraded.'), - 503: _('The Twitter servers are up, but overloaded with requests. Try again later.'), - 504: _('The Twitter servers are up, but the request could not be serviced due to some failure within our stack. Try again later.') + 304: _lt('There was no new data to return.'), + 400: _lt('The request was invalid or cannot be otherwise served. Requests without authentication are considered invalid and will yield this response.'), + 401: _lt('Authentication credentials were missing or incorrect. Maybe screen name tweets are protected.'), + 403: _lt('The request is understood, but it has been refused or access is not allowed. Please check your Twitter API Key and Secret.'), + 429: _lt('Request cannot be served due to the applications rate limit having been exhausted for the resource.'), + 500: _lt('Twitter seems broken. Please retry later. You may consider posting an issue on Twitter forums to get help.'), + 502: _lt('Twitter is down or being upgraded.'), + 503: _lt('The Twitter servers are up, but overloaded with requests. Try again later.'), + 504: _lt('The Twitter servers are up, but the request could not be serviced due to some failure within our stack. Try again later.') } diff --git a/odoo/addons/base/models/res_partner.py b/odoo/addons/base/models/res_partner.py index ce996272ac3..e9c3f91c44a 100644 --- a/odoo/addons/base/models/res_partner.py +++ b/odoo/addons/base/models/res_partner.py @@ -27,7 +27,7 @@ WARNING_MESSAGE = [ ('warning','Warning'), ('block','Blocking Message') ] -WARNING_HELP = _('Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.') +WARNING_HELP = 'Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.' ADDRESS_FIELDS = ('street', 'street2', 'zip', 'city', 'state_id', 'country_id')