summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2018-09-14 10:13:20 +0200
committerMartin Trigaux <mat@odoo.com>2018-09-14 11:20:38 +0200
commita47f7ee0e42604359bdafb90d09d3eba87b701dc (patch)
treec79aa6f55fe5b221d481f2d51eb10d9fc842d91e
parent2e6c1aa5d16f4ede8d9d685336c59e0cac34d487 (diff)
[FIX] product: do not translate at code import
Defined as this, the label of the selection field were translated during code import, when building the python model, not when a user access the field values as it should (and is already the case thanks to the ORM). Trying to translate a string when no user-context is available is not only useless but may cause bug on services with multiple databases (e.g. a SaaS). In a multi-worker environment, when the code is imported, the _ method will use multiple scenarios to detect the language and get a cursor. As we have no available cursor in the frame (method _get_cr from GettextAlias), the fallback is made on the cursor of the request. In a multi-worker environment, this could be a cursor linked to a database in another language than English. In such scenario, the selections would be translated in the language of the other database instead of displaying it in English opw-1881956
-rw-r--r--addons/barcodes/models/barcodes.py6
-rw-r--r--addons/l10n_mx/models/account.py2
-rw-r--r--addons/point_of_sale/models/barcode_rule.py10
-rw-r--r--addons/pos_mercury/models/pos_mercury.py2
-rw-r--r--addons/product/models/product_template.py4
-rw-r--r--addons/project/models/project.py6
-rw-r--r--addons/stock/models/barcode.py8
7 files changed, 19 insertions, 19 deletions
diff --git a/addons/barcodes/models/barcodes.py b/addons/barcodes/models/barcodes.py
index 6c3d228895e..1ee93c3bdd6 100644
--- a/addons/barcodes/models/barcodes.py
+++ b/addons/barcodes/models/barcodes.py
@@ -174,14 +174,14 @@ class BarcodeRule(models.Model):
barcode_nomenclature_id = fields.Many2one('barcode.nomenclature', string='Barcode Nomenclature')
sequence = fields.Integer(string='Sequence', help='Used to order rules such that rules with a smaller sequence match first')
encoding = fields.Selection([
- ('any', _('Any')),
+ ('any', 'Any'),
('ean13', 'EAN-13'),
('ean8', 'EAN-8'),
('upca', 'UPC-A'),
], string='Encoding', required=True, default='any', help='This rule will apply only if the barcode is encoded with the specified encoding')
type = fields.Selection([
- ('alias', _('Alias')),
- ('product', _('Unit Product'))
+ ('alias', 'Alias'),
+ ('product', 'Unit Product')
], string='Type', required=True, default='product')
pattern = fields.Char(string='Barcode Pattern', size=32, help="The barcode matching pattern", required=True, default='.*')
alias = fields.Char(string='Alias', size=32, default='0', help='The matched pattern will alias to this barcode', required=True)
diff --git a/addons/l10n_mx/models/account.py b/addons/l10n_mx/models/account.py
index b1c691c85f6..e7df50dbe0b 100644
--- a/addons/l10n_mx/models/account.py
+++ b/addons/l10n_mx/models/account.py
@@ -55,5 +55,5 @@ class AccountAccountTag(models.Model):
_inherit = 'account.account.tag'
nature = fields.Selection([
- ('D', _('Debitable Account')), ('A', _('Creditable Account'))],
+ ('D', 'Debitable Account'), ('A', 'Creditable Account')],
help='Used in Mexican report of electronic accounting (account nature).')
diff --git a/addons/point_of_sale/models/barcode_rule.py b/addons/point_of_sale/models/barcode_rule.py
index 9fab9caa69a..5e505983006 100644
--- a/addons/point_of_sale/models/barcode_rule.py
+++ b/addons/point_of_sale/models/barcode_rule.py
@@ -9,9 +9,9 @@ class BarcodeRule(models.Model):
_inherit = 'barcode.rule'
type = fields.Selection(selection_add=[
- ('weight', _('Weighted Product')),
- ('price', _('Priced Product')),
- ('discount', _('Discounted Product')),
- ('client', _('Client')),
- ('cashier', _('Cashier'))
+ ('weight', 'Weighted Product'),
+ ('price', 'Priced Product'),
+ ('discount', 'Discounted Product'),
+ ('client', 'Client'),
+ ('cashier', 'Cashier')
])
diff --git a/addons/pos_mercury/models/pos_mercury.py b/addons/pos_mercury/models/pos_mercury.py
index 0c48502ee76..659adca0969 100644
--- a/addons/pos_mercury/models/pos_mercury.py
+++ b/addons/pos_mercury/models/pos_mercury.py
@@ -13,7 +13,7 @@ class BarcodeRule(models.Model):
_inherit = 'barcode.rule'
type = fields.Selection(selection_add=[
- ('credit', _('Credit Card'))
+ ('credit', 'Credit Card')
])
diff --git a/addons/product/models/product_template.py b/addons/product/models/product_template.py
index 9056d40972b..8f27f14e59a 100644
--- a/addons/product/models/product_template.py
+++ b/addons/product/models/product_template.py
@@ -47,8 +47,8 @@ class ProductTemplate(models.Model):
help="A description of the Product that you want to communicate to your customers. "
"This description will be copied to every Sales Order, Delivery Order and Customer Invoice/Credit Note")
type = fields.Selection([
- ('consu', _('Consumable')),
- ('service', _('Service'))], string='Product Type', default='consu', required=True,
+ ('consu', 'Consumable'),
+ ('service', 'Service')], string='Product Type', default='consu', required=True,
help='A stockable product is a product for which you manage stock. The "Inventory" app has to be installed.\n'
'A consumable product, on the other hand, is a product for which stock is not managed.\n'
'A service is a non-material product you provide.\n'
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index 136477a4c1e..89fc9d5741c 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -197,9 +197,9 @@ class Project(models.Model):
help="Internal email associated with this project. Incoming emails are automatically synchronized "
"with Tasks (or optionally Issues if the Issue Tracker module is installed).")
privacy_visibility = fields.Selection([
- ('followers', _('On invitation only')),
- ('employees', _('Visible by all employees')),
- ('portal', _('Visible by following customers')),
+ ('followers', 'On invitation only'),
+ ('employees', 'Visible by all employees'),
+ ('portal', 'Visible by following customers'),
],
string='Privacy', required=True,
default='employees',
diff --git a/addons/stock/models/barcode.py b/addons/stock/models/barcode.py
index 99b88475e47..7daf697f972 100644
--- a/addons/stock/models/barcode.py
+++ b/addons/stock/models/barcode.py
@@ -8,8 +8,8 @@ class BarcodeRule(models.Model):
_inherit = 'barcode.rule'
type = fields.Selection(selection_add=[
- ('weight', _('Weighted Product')),
- ('location', _('Location')),
- ('lot', _('Lot')),
- ('package', _('Package'))
+ ('weight', 'Weighted Product'),
+ ('location', 'Location'),
+ ('lot', 'Lot'),
+ ('package', 'Package')
])