summaryrefslogtreecommitdiff
path: root/addons/barcodes
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 /addons/barcodes
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
Diffstat (limited to 'addons/barcodes')
-rw-r--r--addons/barcodes/models/barcodes.py6
1 files changed, 3 insertions, 3 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)