diff --git a/addons/barcodes/barcodes.py b/addons/barcodes/barcodes.py
index 461860567b5..8e9004aea78 100644
--- a/addons/barcodes/barcodes.py
+++ b/addons/barcodes/barcodes.py
@@ -23,7 +23,7 @@ import logging
import re
import openerp
-from openerp import tools
+from openerp import tools, models, fields
from openerp.osv import fields, osv
from openerp.tools.translate import _
@@ -154,19 +154,25 @@ class barcode_nomenclature(osv.osv):
return parsed_result
return parsed_result
-class barcode_rule(osv.osv):
+class barcode_rule(models.Model):
_name = 'barcode.rule'
_order = 'sequence asc'
+
+ def _get_type_selection(self, cr, uid, context=None):
+ # return [('product','Unit Product'),('weight','Weighted Product'),('price','Priced Product'),('discount','Discounted Product'),('client','Client'),('cashier','Cashier'),('location','Location'),('lot','Lot'),('package','Package')]
+ return [('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([('any','Any'),('ean13','EAN-13'),('ean8','EAN-8'),('codabar','Codabar'),('upca','UPC-A'),('upce','UPC-E')],'Encoding',help='This rule will apply only if the barcode is encoded with the specified encoding'),
'encoding': fields.selection([('any','Any'),('ean13','EAN-13')],'Encoding',required=True,help='This rule will apply only if the barcode is encoded with the specified encoding'),
- 'type': fields.selection([('product','Unit Product'),('weight','Weighted Product'),('price','Priced Product'),('discount','Discounted Product'),('client','Client'),('cashier','Cashier'),('location','Location'),('lot','Lot'),('package','Package')],'Type', required=True),
+ 'type': fields.selection([('product','Unit Product')],'Type', required=True),
'pattern': fields.char('Barcode Pattern', size=32, help="The barcode matching pattern"),
#'alias': fields.char('Alias',size=32,help='The matched pattern will alias to this barcode'),
}
+ #type = openerp.fields.Selection([('product','Unit Product')],'Type', required=True)
_defaults = {
'type': 'product',
diff --git a/addons/barcodes/data/barcodes_data.xml b/addons/barcodes/data/barcodes_data.xml
index cee84980cc7..4ad60aa7fec 100644
--- a/addons/barcodes/data/barcodes_data.xml
+++ b/addons/barcodes/data/barcodes_data.xml
@@ -13,77 +13,5 @@
ean13
*
-
-
- Cashier Barcodes
-
- 50
- cashier
- any
- 041
-
-
-
- Customer Barcodes
-
- 40
- client
- any
- 042
-
-
-
- Weight Barcodes 3 Decimals
-
- 36
- weight
- ean13
- 21*****{NNDDD}*
-
-
-
- Discount Barcodes
-
- 20
- discount
- any
- 22{NN}*
-
-
-
- Price Barcodes 2 Decimals
-
- 14
- price
- ean13
- 23*****{NNNDD}*
-
-
-
- Package barcodes
-
- 70
- package
- any
- PACK*
-
-
-
- Lot barcodes
-
- 80
- lot
- any
- 10*
-
-
-
- Location barcodes
-
- 60
- location
- any
- 414*
-
\ No newline at end of file
diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py
index 91192feba67..85907b40ee6 100644
--- a/addons/point_of_sale/__openerp__.py
+++ b/addons/point_of_sale/__openerp__.py
@@ -51,6 +51,7 @@ Main Features
'depends': ['sale_stock', 'barcodes'],
'data': [
'data/report_paperformat.xml',
+ #'data/default_barcode_patterns.xml',
'security/point_of_sale_security.xml',
'security/ir.model.access.csv',
'wizard/pos_box.xml',
diff --git a/addons/point_of_sale/data/default_barcode_patterns.xml b/addons/point_of_sale/data/default_barcode_patterns.xml
new file mode 100644
index 00000000000..74e5bec97da
--- /dev/null
+++ b/addons/point_of_sale/data/default_barcode_patterns.xml
@@ -0,0 +1,49 @@
+
+
+
+
+ Cashier Barcodes
+
+ 50
+ cashier
+ any
+ 041
+
+
+
+ Customer Barcodes
+
+ 40
+ client
+ any
+ 042
+
+
+
+ Weight Barcodes 3 Decimals
+
+ 36
+ weight
+ ean13
+ 21*****{NNDDD}*
+
+
+
+ Discount Barcodes
+
+ 20
+ discount
+ any
+ 22{NN}*
+
+
+
+ Price Barcodes 2 Decimals
+
+ 14
+ price
+ ean13
+ 23*****{NNNDD}*
+
+
+
\ No newline at end of file
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 93f4ac17adf..58eebac6c6f 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -23,7 +23,7 @@ import logging
import time
import uuid
-from openerp import tools
+from openerp import tools, models
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.exceptions import Warning
@@ -1449,6 +1449,15 @@ class res_partner(osv.osv):
return partner_id
+class barcode_rule(models.Model):
+ _inherit = 'barcode.rule'
+ type = openerp.fields.Selection(selection_add=[
+ ('weight','Weighted Product'),
+ ('price','Priced Product'),
+ ('discount','Discounted Product'),
+ ('client','Client'),
+ ('cashier','Cashier')
+ ])
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index ed76de34d4a..a77aca9b774 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -66,6 +66,7 @@ Dashboard / Reports for Warehouse Management will include:
'stock_location_demo_cpu3.yml',
],
'data': [
+ #'data/default_barcode_patterns.xml',
'security/stock_security.xml',
'security/ir.model.access.csv',
'stock_data.xml',
diff --git a/addons/stock/data/default_barcode_patterns.xml b/addons/stock/data/default_barcode_patterns.xml
new file mode 100644
index 00000000000..c3ec2a40f88
--- /dev/null
+++ b/addons/stock/data/default_barcode_patterns.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ Package barcodes
+
+ 70
+ package
+ any
+ PACK*
+
+
+
+ Lot barcodes
+
+ 80
+ lot
+ any
+ 10*
+
+
+
+ Location barcodes
+
+ 60
+ location
+ any
+ 414*
+
+
+
\ No newline at end of file
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index ff68fba4574..bad5b7baec1 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -24,10 +24,11 @@ from dateutil import relativedelta
import json
import time
+import openerp
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
-from openerp import SUPERUSER_ID, api
+from openerp import SUPERUSER_ID, api, models
import openerp.addons.decimal_precision as dp
from openerp.addons.procurement import procurement
import logging
@@ -1332,7 +1333,6 @@ class stock_picking(osv.osv):
@api.cr_uid_ids_context
def do_transfer(self, cr, uid, picking_ids, context=None):
- print "DO TRANSFER"
"""
If no pack operation, we do simple action_done of the picking
Otherwise, do the pack operations
@@ -1341,7 +1341,6 @@ class stock_picking(osv.osv):
context = {}
stock_move_obj = self.pool.get('stock.move')
for picking in self.browse(cr, uid, picking_ids, context=context):
- print picking
if not picking.pack_operation_ids:
self.action_done(cr, uid, [picking.id], context=context)
continue
@@ -4315,4 +4314,13 @@ class stock_picking_type(osv.osv):
'active': True,
}
+class barcode_rule(models.Model):
+ _inherit = 'barcode.rule'
+
+ type = openerp.fields.Selection(selection_add=[
+ ('location','Location'),
+ ('lot','Lot'),
+ ('package','Package')
+ ])
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: