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
16 lines
401 B
Python
16 lines
401 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models, fields, _
|
|
|
|
|
|
class BarcodeRule(models.Model):
|
|
_inherit = 'barcode.rule'
|
|
|
|
type = fields.Selection(selection_add=[
|
|
('weight', 'Weighted Product'),
|
|
('location', 'Location'),
|
|
('lot', 'Lot'),
|
|
('package', 'Package')
|
|
])
|