summaryrefslogtreecommitdiff
path: root/addons/barcodes/barcodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/barcodes/barcodes.py')
-rw-r--r--addons/barcodes/barcodes.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/addons/barcodes/barcodes.py b/addons/barcodes/barcodes.py
index c9b9118728a..5a780657c1a 100644
--- a/addons/barcodes/barcodes.py
+++ b/addons/barcodes/barcodes.py
@@ -173,26 +173,28 @@ class barcode_nomenclature(osv.osv):
return parsed_result
-ENCODINGS = [
- ('any','Any'),
- ('ean13','EAN-13'),
- ('ean8','EAN-8'),
- ('upca','UPC-A'),
-]
-
class barcode_rule(models.Model):
_name = 'barcode.rule'
_order = 'sequence asc'
@api.model
+ def _encoding_selection_list(self):
+ return [
+ ('any', 'Any'),
+ ('ean13', 'EAN-13'),
+ ('ean8', 'EAN-8'),
+ ('upca', 'UPC-A'),
+ ]
+
+ @api.model
def _get_type_selection(self):
return [('alias','Alias'),('product','Unit Product')]
-
+
_columns = {
'name': fields.char('Rule Name', size=32, required=True, help='An internal identification for this barcode nomenclature rule'),
'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature'),
'sequence': fields.integer('Sequence', help='Used to order rules such that rules with a smaller sequence match first'),
- 'encoding': fields.selection(ENCODINGS,'Encoding',required=True,help='This rule will apply only if the barcode is encoded with the specified encoding'),
+ 'encoding': fields.selection('_encoding_selection_list','Encoding',required=True,help='This rule will apply only if the barcode is encoded with the specified encoding'),
'type': fields.selection('_get_type_selection','Type', required=True),
'pattern': fields.char('Barcode Pattern', size=32, help="The barcode matching pattern", required=True),
'alias': fields.char('Alias',size=32,help='The matched pattern will alias to this barcode', required=True),