diff --git a/addons/bus/controllers/main.py b/addons/bus/controllers/main.py index 4e82116e7c7..bdbdd47096b 100644 --- a/addons/bus/controllers/main.py +++ b/addons/bus/controllers/main.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from odoo import exceptions +from odoo import exceptions, _ from odoo.http import Controller, request, route from odoo.addons.bus.models.bus import dispatch @@ -38,5 +38,5 @@ class BusController(Controller): if [c for c in channels if not isinstance(c, pycompat.string_types)]: raise Exception("bus.Bus only string channels are allowed.") if request.registry.in_test_mode(): - raise exceptions.UserError("bus.Bus not available in test mode") + raise exceptions.UserError(_("bus.Bus not available in test mode")) return self._poll(request.db, channels, last, options) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 10c3f0f7782..8b44843e2c3 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -640,8 +640,8 @@ class PurchaseOrderLine(models.Model): if line.product_id.type in ('product', 'consu'): # Prevent decreasing below received quantity if float_compare(line.product_qty, line.qty_received, line.product_uom.rounding) < 0: - raise UserError('You cannot decrease the ordered quantity below the received quantity.\n' - 'Create a return first.') + raise UserError(_('You cannot decrease the ordered quantity below the received quantity.\n' + 'Create a return first.')) if float_compare(line.product_qty, line.qty_invoiced, line.product_uom.rounding) == -1: # If the quantity is now below the invoiced quantity, create an activity on the vendor bill diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index b7d06ae056a..4de9ca99713 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -322,8 +322,8 @@ class SaleOrderLine(models.Model): def _update_line_quantity(self, values): if self.mapped('qty_delivered') and values['product_uom_qty'] < max(self.mapped('qty_delivered')): - raise UserError('You cannot decrease the ordered quantity below the delivered quantity.\n' - 'Create a return first.') + raise UserError(_('You cannot decrease the ordered quantity below the delivered quantity.\n' + 'Create a return first.')) for line in self: pickings = self.order_id.picking_ids.filtered(lambda p: p.state not in ('done', 'cancel')) for picking in pickings: diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 7ef8306d976..ab81cd58caf 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -256,7 +256,7 @@ class StockMove(models.Model): elif len(move_lines) == 1: move_lines[0].qty_done = quantity_done else: - raise UserError("Cannot set the done quantity from this stock move, work directly with the move lines.") + raise UserError(_("Cannot set the done quantity from this stock move, work directly with the move lines.")) def _set_product_qty(self): """ The meaning of product_qty field changed lately and is now a functional field computing the quantity diff --git a/addons/stock/wizard/stock_picking_return.py b/addons/stock/wizard/stock_picking_return.py index eb2c5328352..dfd07fe93aa 100644 --- a/addons/stock/wizard/stock_picking_return.py +++ b/addons/stock/wizard/stock_picking_return.py @@ -32,7 +32,7 @@ class ReturnPicking(models.TransientModel): @api.model def default_get(self, fields): if len(self.env.context.get('active_ids', list())) > 1: - raise UserError("You may only return one picking at a time!") + raise UserError(_("You may only return one picking at a time!")) res = super(ReturnPicking, self).default_get(fields) move_dest_exists = False diff --git a/addons/survey/models/survey.py b/addons/survey/models/survey.py index 99faaaa5b8e..78ea2b17810 100644 --- a/addons/survey/models/survey.py +++ b/addons/survey/models/survey.py @@ -684,7 +684,7 @@ class SurveyLabel(models.Model): def _check_question_not_empty(self): """Ensure that field question_id XOR field question_id_2 is not null""" if not bool(self.question_id) != bool(self.question_id_2): - raise ValidationError("A label must be attached to one and only one question") + raise ValidationError(_("A label must be attached to one and only one question")) class SurveyUserInput(models.Model): diff --git a/addons/web_settings_dashboard/controllers/main.py b/addons/web_settings_dashboard/controllers/main.py index 34e660b0bb0..fdda07c5090 100644 --- a/addons/web_settings_dashboard/controllers/main.py +++ b/addons/web_settings_dashboard/controllers/main.py @@ -3,7 +3,7 @@ from datetime import datetime, timedelta -from odoo import fields, http +from odoo import _, fields, http from odoo.exceptions import AccessError from odoo.http import request from odoo import release @@ -13,7 +13,7 @@ class WebSettingsDashboard(http.Controller): @http.route('/web_settings_dashboard/data', type='json', auth='user') def web_settings_dashboard_data(self, **kw): if not request.env.user.has_group('base.group_erp_manager'): - raise AccessError("Access Denied") + raise AccessError(_("Access Denied")) installed_apps = request.env['ir.module.module'].search_count([ ('application', '=', True), diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py index 00058c537b1..3f924843bef 100644 --- a/odoo/addons/base/ir/ir_model.py +++ b/odoo/addons/base/ir/ir_model.py @@ -1358,7 +1358,7 @@ class IrModelData(models.Model): if self.env[model].search([('id', '=', res_id)]): return model, res_id if raise_on_access_error: - raise AccessError('Not enough access rights on the external ID: %s.%s' % (module, xml_id)) + raise AccessError(_('Not enough access rights on the external ID:') + ' %s.%s' % (module, xml_id)) return model, False @api.model