[IMP] pos_barcodes: fix some wrongly named variables, fix missing barcode nomenclatur...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Wed, 1 Oct 2014 11:40:02 +0000 (13:40 +0200)
committerFrédéric van der Essen <fvdessen@gmail.com>
Tue, 25 Nov 2014 18:16:26 +0000 (19:16 +0100)
addons/pos_barcodes/barcodes.py
addons/pos_barcodes/barcodes_view.xml
addons/pos_barcodes/static/src/js/barcodes.js

index 492f573..370b28d 100644 (file)
@@ -44,13 +44,13 @@ class barcode_rule(osv.osv):
         'barcode_nomenclature_id':     fields.many2one('barcode.nomenclature','Barcode Nomenclature'),
         'priority': fields.float('Priority', help='Rules with a higher priority 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'),
-        'type':     fields.selection([('unit','Unit Product'),('weight','Weighted Product'),('price','Priced Product'),('discount','Discounted Product'),('client','Client'),('cashier','Cashier')],'Type', required=True),
+        'type':     fields.selection([('product','Unit Product'),('weight','Weighted Product'),('price','Priced Product'),('discount','Discounted Product'),('client','Client'),('cashier','Cashier')],'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'),      
     }
 
     _defaults = {
-        'type': 'unit',
+        'type': 'product',
         'pattern': '*',
         #'encoding': 'any',
     }
index 30e6b23..2d0ba20 100644 (file)
@@ -2,6 +2,19 @@
 <openerp>
     <data>
 
+        <record model="ir.ui.view" id="view_pos_config_form">
+            <field name="name">pos.config.form.view</field>
+            <field name="model">pos.config</field>
+            <field name="inherit_id" ref="point_of_sale.view_pos_config_form" />
+            <field name="arch" type="xml">
+                <xpath expr="//group[@string='Barcode Types']" position="after">
+                    <group string="Barcode Nomenclature" col="4" >
+                        <field name="barcode_nomenclature_id" />
+                    </group>
+                </xpath>
+            </field>
+        </record>
+
         <!--     BARCODE NOMENCLATURES     -->
 
         <record model="ir.ui.view" id="view_barcode_nomenclature_form">
@@ -75,6 +88,5 @@
             sequence="30"
             groups="point_of_sale.group_pos_manager"/>
 
-
     </data>
 </openerp>
index 460a12c..d3e0717 100644 (file)
@@ -110,8 +110,8 @@ openerp.pos_barcodes = function(instance){
             for (var i = 0; i < rules.length; i++) {
                 if (match_pattern(ean,rules[i].pattern)) {
                     parse_result.type      = rules[i].type;
-                    parse_result.value     = get_value(ean,patterns[i].pattern);
-                    parse_result.base_code = get_basecode(ean,patterns[i].pattern);
+                    parse_result.value     = get_value(ean,rules[i].pattern);
+                    parse_result.base_code = get_basecode(ean,rules[i].pattern);
                     return parse_result;
                 }
             }