[FIX] base(res_partner),point_of_sale,product,sale_stock,stock: uniformization of field barcode in res.partner, res.user, product.product, product.packaging and product.template
Conflicts: addons/point_of_sale/res_partner_view.xml
This commit is contained in:
committed by
Frédéric van der Essen
parent
1526af8cb5
commit
32fcfa657c
@@ -1344,7 +1344,7 @@ class ean_wizard(osv.osv_memory):
|
||||
ean13 = openerp.addons.product.product.sanitize_ean13(r.ean13_pattern)
|
||||
m = context.get('active_model')
|
||||
m_id = context.get('active_id')
|
||||
self.pool[m].write(cr,uid,[m_id],{'ean13':ean13})
|
||||
self.pool[m].write(cr,uid,[m_id],{'barcode':ean13})
|
||||
return { 'type' : 'ir.actions.act_window_close' }
|
||||
|
||||
class pos_category(osv.osv):
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Partners with EAN13s -->
|
||||
<record id='base.res_partner_1' model='res.partner'> <field name='ean13'>0420100000005</field> </record>
|
||||
<record id='base.res_partner_2' model='res.partner'> <field name='ean13'>0420200000004</field> </record>
|
||||
<record id='base.res_partner_3' model='res.partner'> <field name='ean13'>0420300000003</field> </record>
|
||||
<record id='base.res_partner_4' model='res.partner'> <field name='ean13'>0420400000002</field> </record>
|
||||
<record id='base.res_partner_5' model='res.partner'> <field name='ean13'>0420500000001</field> </record>
|
||||
<record id='base.res_partner_6' model='res.partner'> <field name='ean13'>0420600000000</field> </record>
|
||||
<record id='base.res_partner_7' model='res.partner'> <field name='ean13'>0420700000009</field> </record>
|
||||
<record id='base.res_partner_8' model='res.partner'> <field name='ean13'>0420800000008</field> </record>
|
||||
<record id='base.res_partner_9' model='res.partner'> <field name='ean13'>0420900000007</field> </record>
|
||||
<record id='base.res_partner_10' model='res.partner'> <field name='ean13'>0421000000003</field> </record>
|
||||
<record id='base.res_partner_11' model='res.partner'> <field name='ean13'>0421100000002</field> </record>
|
||||
<record id='base.res_partner_12' model='res.partner'> <field name='ean13'>0421200000001</field> </record>
|
||||
<record id='base.res_partner_13' model='res.partner'> <field name='ean13'>0421300000000</field> </record>
|
||||
<record id='base.res_partner_14' model='res.partner'> <field name='ean13'>0421400000009</field> </record>
|
||||
<record id='base.res_partner_15' model='res.partner'> <field name='ean13'>0421500000008</field> </record>
|
||||
<record id='base.res_partner_16' model='res.partner'> <field name='ean13'>0421600000007</field> </record>
|
||||
<record id='base.res_partner_17' model='res.partner'> <field name='ean13'>0421700000006</field> </record>
|
||||
<record id='base.res_partner_18' model='res.partner'> <field name='ean13'>0421800000005</field> </record>
|
||||
<record id='base.res_partner_19' model='res.partner'> <field name='ean13'>0421900000004</field> </record>
|
||||
<record id='base.res_partner_20' model='res.partner'> <field name='ean13'>0422000000000</field> </record>
|
||||
<record id='base.res_partner_21' model='res.partner'> <field name='ean13'>0422100000009</field> </record>
|
||||
<!-- Partners with Barcodes -->
|
||||
<record id='base.res_partner_1' model='res.partner'> <field name='barcode'>0420100000005</field> </record>
|
||||
<record id='base.res_partner_2' model='res.partner'> <field name='barcode'>0420200000004</field> </record>
|
||||
<record id='base.res_partner_3' model='res.partner'> <field name='barcode'>0420300000003</field> </record>
|
||||
<record id='base.res_partner_4' model='res.partner'> <field name='barcode'>0420400000002</field> </record>
|
||||
<record id='base.res_partner_5' model='res.partner'> <field name='barcode'>0420500000001</field> </record>
|
||||
<record id='base.res_partner_6' model='res.partner'> <field name='barcode'>0420600000000</field> </record>
|
||||
<record id='base.res_partner_7' model='res.partner'> <field name='barcode'>0420700000009</field> </record>
|
||||
<record id='base.res_partner_8' model='res.partner'> <field name='barcode'>0420800000008</field> </record>
|
||||
<record id='base.res_partner_9' model='res.partner'> <field name='barcode'>0420900000007</field> </record>
|
||||
<record id='base.res_partner_10' model='res.partner'> <field name='barcode'>0421000000003</field> </record>
|
||||
<record id='base.res_partner_11' model='res.partner'> <field name='barcode'>0421100000002</field> </record>
|
||||
<record id='base.res_partner_12' model='res.partner'> <field name='barcode'>0421200000001</field> </record>
|
||||
<record id='base.res_partner_13' model='res.partner'> <field name='barcode'>0421300000000</field> </record>
|
||||
<record id='base.res_partner_14' model='res.partner'> <field name='barcode'>0421400000009</field> </record>
|
||||
<record id='base.res_partner_15' model='res.partner'> <field name='barcode'>0421500000008</field> </record>
|
||||
<record id='base.res_partner_16' model='res.partner'> <field name='barcode'>0421600000007</field> </record>
|
||||
<record id='base.res_partner_17' model='res.partner'> <field name='barcode'>0421700000006</field> </record>
|
||||
<record id='base.res_partner_18' model='res.partner'> <field name='barcode'>0421800000005</field> </record>
|
||||
<record id='base.res_partner_19' model='res.partner'> <field name='barcode'>0421900000004</field> </record>
|
||||
<record id='base.res_partner_20' model='res.partner'> <field name='barcode'>0422000000000</field> </record>
|
||||
<record id='base.res_partner_21' model='res.partner'> <field name='barcode'>0422100000009</field> </record>
|
||||
|
||||
<record id="base.user_root" model="res.users">
|
||||
<field name="ean13">0410100000006</field>
|
||||
<field name="barcode">0410100000006</field>
|
||||
</record>
|
||||
<record id="account.cash_journal" model="account.journal">
|
||||
<field eval="True" name="journal_user"/>
|
||||
</record>
|
||||
<record id="base.user_root" model="res.users">
|
||||
<field name="ean13">0410100000006</field>
|
||||
<field name="barcode">0410100000006</field>
|
||||
<field name="groups_id" eval="[(4,ref('group_pos_manager'))]"/>
|
||||
</record>
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
<field name="list_price">1.98</field>
|
||||
<field name="name">Boni Oranges</field>
|
||||
<field name="to_weight">True</field>
|
||||
<field name="ean13">2100002000003</field>
|
||||
<field name="barcode">2100002000003</field>
|
||||
<field name="pos_categ_id" ref="oranges"/>
|
||||
<field name="uom_id" ref="product.product_uom_kgm" />
|
||||
<field name="uom_po_id" ref="product.product_uom_kgm" />
|
||||
@@ -212,7 +212,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">1.98</field>
|
||||
<field name="name">Lemon</field>
|
||||
<field name="ean13">2301000000006</field>
|
||||
<field name="barcode">2301000000006</field>
|
||||
<field name="to_weight">True</field>
|
||||
<field name="pos_categ_id" ref="autres_agrumes"/>
|
||||
<field name="uom_id" ref="product.product_uom_kgm" />
|
||||
@@ -297,7 +297,7 @@
|
||||
<field name="list_price">5.10</field>
|
||||
<field name="name">Peaches</field>
|
||||
<field name="to_weight">True</field>
|
||||
<field name="ean13">2300001000008</field>
|
||||
<field name="barcode">2300001000008</field>
|
||||
<field name="pos_categ_id" ref="rouges_noyau_fruits"/>
|
||||
<field name="uom_id" ref="product.product_uom_kgm" />
|
||||
<field name="uom_po_id" ref="product.product_uom_kgm" />
|
||||
@@ -373,7 +373,7 @@
|
||||
<field name="list_price">1.28</field>
|
||||
<field name="name">Onions</field>
|
||||
<field name="to_weight">True</field>
|
||||
<field name="ean13">2100001000004</field>
|
||||
<field name="barcode">2100001000004</field>
|
||||
<field name="pos_categ_id" ref="oignons_ail_echalotes"/>
|
||||
<field name="uom_id" ref="product.product_uom_kgm" />
|
||||
<field name="uom_po_id" ref="product.product_uom_kgm" />
|
||||
@@ -435,7 +435,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">1.49</field>
|
||||
<field name="name">Coca-Cola Regular 1L</field>
|
||||
<field name="ean13">5449000054227</field>
|
||||
<field name="barcode">5449000054227</field>
|
||||
<field name="pos_categ_id" ref="coke"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/coca_regular_1l-image.jpg"/>
|
||||
</record>
|
||||
@@ -457,7 +457,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">0.51</field>
|
||||
<field name="name">Coca-Cola Regular 33cl</field>
|
||||
<field name="ean13">5449000000996</field>
|
||||
<field name="barcode">5449000000996</field>
|
||||
<field name="pos_categ_id" ref="coke"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/coca_regular_33cl-image.jpg"/>
|
||||
</record>
|
||||
@@ -722,7 +722,7 @@
|
||||
<record id="chaudfontaine_50cl" model="product.product">
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">0.44</field>
|
||||
<field name="ean13">5449000111715</field>
|
||||
<field name="barcode">5449000111715</field>
|
||||
<field name="name">Chaudfontaine 50cl</field>
|
||||
<field name="pos_categ_id" ref="plain_water"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/chaudfontaine_50cl-image.jpg"/>
|
||||
@@ -837,7 +837,7 @@
|
||||
<record id="jupiler_33cl" model="product.product">
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">0.77</field>
|
||||
<field name="ean13">5410228142027</field>
|
||||
<field name="barcode">5410228142027</field>
|
||||
<field name="name">Jupiler 33cl</field>
|
||||
<field name="pos_categ_id" ref="pils"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/jupiler_33cl-image.jpg"/>
|
||||
@@ -896,7 +896,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">0.83</field>
|
||||
<field name="name">Belle-Vue Kriek 25cl</field>
|
||||
<field name='ean13'>5410228193449</field>
|
||||
<field name='barcode'>5410228193449</field>
|
||||
<field name="pos_categ_id" ref="fruity_beers"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/belle_vue_kriek_25cl-image.jpg"/>
|
||||
</record>
|
||||
@@ -905,7 +905,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">1.00</field>
|
||||
<field name="name">Leffe Brune 33cl</field>
|
||||
<field name='ean13'>5410228142164</field>
|
||||
<field name='barcode'>5410228142164</field>
|
||||
<field name="pos_categ_id" ref="special_beers"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/leffe_brune_33cl-image.jpg"/>
|
||||
</record>
|
||||
@@ -913,7 +913,7 @@
|
||||
<field name="available_in_pos">True</field>
|
||||
<field name="list_price">1.00</field>
|
||||
<field name="name">Leffe Blonde 33cl</field>
|
||||
<field name='ean13'>5410228142218</field>
|
||||
<field name='barcode'>5410228142218</field>
|
||||
<field name="pos_categ_id" ref="special_beers"/>
|
||||
<field name="image" type="base64" file="point_of_sale/static/img/leffe_blonde_33cl-image.jpg"/>
|
||||
</record>
|
||||
|
||||
@@ -553,7 +553,7 @@
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="ean13" position="after">
|
||||
<field name="barcode" position="after">
|
||||
<button colspan="2" name="%(action_edit_ean)d" type="action" string="Set a Custom EAN"
|
||||
attrs="{'invisible': [('product_variant_count', '>', 1)]}" class="oe_link oe_edit_only"/>
|
||||
</field>
|
||||
@@ -564,7 +564,7 @@
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="ean13" position="after">
|
||||
<field name="barcode" position="after">
|
||||
<button colspan="2" name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_link oe_edit_only"/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<lots>
|
||||
<lot-line type="fields" name="id">
|
||||
<username type="field" name="name"/>
|
||||
<ean13 type="field" name="ean13"/>
|
||||
<barcode type="field" name="barcode"/>
|
||||
</lot-line>
|
||||
</lots>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<barCode><xsl:value-of select="ean13" /></barCode>
|
||||
<barCode><xsl:value-of select="barcode" /></barCode>
|
||||
</td>
|
||||
<td>
|
||||
<para style="nospace"><xsl:value-of select="username"/></para>
|
||||
|
||||
@@ -9,17 +9,5 @@ import openerp.addons.product.product
|
||||
class res_users(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
# 'ean13' : fields.char('EAN13', size=13, help="BarCode"),
|
||||
'ean13' : fields.char('Barcode', help="BarCode"),
|
||||
}
|
||||
|
||||
# def _check_ean(self, cr, uid, ids, context=None):
|
||||
# return all(
|
||||
# openerp.addons.product.product.check_ean(user.ean13) == True
|
||||
# for user in self.browse(cr, uid, ids, context=context)
|
||||
# )
|
||||
|
||||
# _constraints = [
|
||||
# (_check_ean, "Error: Invalid ean code", ['ean13'],),
|
||||
# ]
|
||||
|
||||
'barcode' : fields.char('Barcode', help="BarCode", oldname='ean13'),
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
<xpath expr="//group[@name='warehouse']" position="before">
|
||||
<group name="point_of_sale" position="replace">
|
||||
<group string="Point of Sale">
|
||||
<field name="ean13" />
|
||||
<field name="barcode" />
|
||||
<button name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" />
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -9,18 +9,7 @@ import openerp.addons.product.product
|
||||
class res_users(osv.osv):
|
||||
_inherit = 'res.users'
|
||||
_columns = {
|
||||
# 'ean13' : fields.char('EAN13', size=13, help="BarCode"),
|
||||
'ean13' : fields.char('Barcode', help="BarCode"),
|
||||
'barcode' : fields.char('Barcode', help="BarCode", oldname='ean13'),
|
||||
'pos_config' : fields.many2one('pos.config', 'Default Point of Sale', domain=[('state', '=', 'active')]),
|
||||
}
|
||||
|
||||
# def _check_ean(self, cr, uid, ids, context=None):
|
||||
# return all(
|
||||
# openerp.addons.product.product.check_ean(user.ean13) == True
|
||||
# for user in self.browse(cr, uid, ids, context=context)
|
||||
# )
|
||||
|
||||
# _constraints = [
|
||||
# (_check_ean, "Error: Invalid ean code", ['ean13'],),
|
||||
# ]
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<page string="Point of Sale">
|
||||
<group>
|
||||
<field name="pos_config" />
|
||||
<field name="ean13" />
|
||||
<field name="barcode" />
|
||||
<button name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_edit_only" />
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -22,13 +22,13 @@ function openerp_pos_db(instance, module){
|
||||
this.cache = {};
|
||||
|
||||
this.product_by_id = {};
|
||||
this.product_by_ean13 = {};
|
||||
this.product_by_barcode = {};
|
||||
this.product_by_category_id = {};
|
||||
//this.product_by_reference = {};
|
||||
|
||||
this.partner_sorted = [];
|
||||
this.partner_by_id = {};
|
||||
this.partner_by_ean13 = {};
|
||||
this.partner_by_barcode = {};
|
||||
this.partner_search_string = "";
|
||||
this.partner_write_date = null;
|
||||
|
||||
@@ -41,7 +41,7 @@ function openerp_pos_db(instance, module){
|
||||
this.category_search_string = {};
|
||||
this.packagings_by_id = {};
|
||||
this.packagings_by_product_tmpl_id = {};
|
||||
this.packagings_by_ean13 = {};
|
||||
this.packagings_by_barcode = {};
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -144,8 +144,8 @@ function openerp_pos_db(instance, module){
|
||||
},
|
||||
_product_search_string: function(product){
|
||||
var str = '' + product.id + ':' + product.display_name;
|
||||
if (product.ean13) {
|
||||
str += '|' + product.ean13;
|
||||
if (product.barcode) {
|
||||
str += '|' + product.barcode;
|
||||
}
|
||||
if (product.default_code) {
|
||||
str += '|' + product.default_code.replace(':','');
|
||||
@@ -158,7 +158,7 @@ function openerp_pos_db(instance, module){
|
||||
}
|
||||
var packagings = this.packagings_by_product_tmpl_id[product.product_tmpl_id] || [];
|
||||
for (var i = 0; i < packagings.length; i++) {
|
||||
str += '|' + packagings[i].ean;
|
||||
str += '|' + packagings[i].barcode;
|
||||
}
|
||||
return str + '\n';
|
||||
},
|
||||
@@ -198,8 +198,8 @@ function openerp_pos_db(instance, module){
|
||||
this.category_search_string[ancestor] += search_string;
|
||||
}
|
||||
this.product_by_id[product.id] = product;
|
||||
if(product.ean13){
|
||||
this.product_by_ean13[product.ean13] = product;
|
||||
if(product.barcode){
|
||||
this.product_by_barcode[product.barcode] = product;
|
||||
}
|
||||
/*if(product.default_code){
|
||||
this.product_by_reference[product.default_code] = product;
|
||||
@@ -214,15 +214,15 @@ function openerp_pos_db(instance, module){
|
||||
this.packagings_by_product_tmpl_id[pack.product_tmpl_id[0]] = [];
|
||||
}
|
||||
this.packagings_by_product_tmpl_id[pack.product_tmpl_id[0]].push(pack);
|
||||
if(pack.ean){
|
||||
this.packagings_by_ean13[pack.ean] = pack;
|
||||
if(pack.barcode){
|
||||
this.packagings_by_barcode[pack.barcode] = pack;
|
||||
}
|
||||
}
|
||||
},
|
||||
_partner_search_string: function(partner){
|
||||
var str = '' + partner.id + ':' + partner.name;
|
||||
if(partner.ean13){
|
||||
str += '|' + partner.ean13;
|
||||
if(partner.barcode){
|
||||
str += '|' + partner.barcode;
|
||||
}
|
||||
if(partner.address){
|
||||
str += '|' + partner.address;
|
||||
@@ -268,16 +268,16 @@ function openerp_pos_db(instance, module){
|
||||
|
||||
if (updated_count) {
|
||||
// If there were updates, we need to completely
|
||||
// rebuild the search string and the ean13 indexing
|
||||
// rebuild the search string and the barcode indexing
|
||||
|
||||
this.partner_search_string = "";
|
||||
this.partner_by_ean13 = {};
|
||||
this.partner_by_barcode = {};
|
||||
|
||||
for (var id in this.partner_by_id) {
|
||||
var partner = this.partner_by_id[id];
|
||||
|
||||
if(partner.ean13){
|
||||
this.partner_by_ean13[partner.ean13] = partner;
|
||||
if(partner.barcode){
|
||||
this.partner_by_barcode[partner.barcode] = partner;
|
||||
}
|
||||
partner.address = (partner.street || '') +', '+
|
||||
(partner.zip || '') +' '+
|
||||
@@ -294,8 +294,8 @@ function openerp_pos_db(instance, module){
|
||||
get_partner_by_id: function(id){
|
||||
return this.partner_by_id[id];
|
||||
},
|
||||
get_partner_by_ean13: function(ean13){
|
||||
return this.partner_by_ean13[ean13];
|
||||
get_partner_by_barcode: function(barcode){
|
||||
return this.partner_by_barcode[barcode];
|
||||
},
|
||||
get_partners_sorted: function(max_count){
|
||||
max_count = max_count ? Math.min(this.partner_sorted.length, max_count) : this.partner_sorted.length;
|
||||
@@ -344,11 +344,11 @@ function openerp_pos_db(instance, module){
|
||||
get_product_by_id: function(id){
|
||||
return this.product_by_id[id];
|
||||
},
|
||||
get_product_by_ean13: function(ean13){
|
||||
if(this.product_by_ean13[ean13]){
|
||||
return this.product_by_ean13[ean13];
|
||||
get_product_by_barcode: function(barcode){
|
||||
if(this.product_by_barcode[barcode]){
|
||||
return this.product_by_barcode[barcode];
|
||||
}
|
||||
var pack = this.packagings_by_ean13[ean13];
|
||||
var pack = this.packagings_by_barcode<[barcode];
|
||||
if(pack){
|
||||
return this.product_by_id[pack.product_tmpl_id[0]];
|
||||
}
|
||||
@@ -369,7 +369,7 @@ function openerp_pos_db(instance, module){
|
||||
},
|
||||
/* returns a list of products with :
|
||||
* - a category that is or is a child of category_id,
|
||||
* - a name, package or ean13 containing the query (case insensitive)
|
||||
* - a name, package or barcode containing the query (case insensitive)
|
||||
*/
|
||||
search_product_in_category: function(category_id, query){
|
||||
try {
|
||||
|
||||
@@ -167,12 +167,12 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
}
|
||||
},{
|
||||
model: 'res.users',
|
||||
fields: ['name','ean13'],
|
||||
fields: ['name','barcode'],
|
||||
domain: null,
|
||||
loaded: function(self,users){ self.users = users; },
|
||||
},{
|
||||
model: 'res.partner',
|
||||
fields: ['name','street','city','state_id','country_id','vat','phone','zip','mobile','email','ean13','write_date'],
|
||||
fields: ['name','street','city','state_id','country_id','vat','phone','zip','mobile','email','barcode','write_date'],
|
||||
domain: null,
|
||||
loaded: function(self,partners){
|
||||
self.partners = partners;
|
||||
@@ -250,7 +250,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
},
|
||||
},{
|
||||
model: 'product.packaging',
|
||||
fields: ['ean','product_tmpl_id'],
|
||||
fields: ['barcode','product_tmpl_id'],
|
||||
domain: null,
|
||||
loaded: function(self, packagings){
|
||||
self.db.add_packagings(packagings);
|
||||
@@ -264,7 +264,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
},
|
||||
},{
|
||||
model: 'product.product',
|
||||
fields: ['display_name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
|
||||
fields: ['display_name', 'list_price','price','pos_categ_id', 'taxes_id', 'barcode', 'default_code',
|
||||
'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description',
|
||||
'product_tmpl_id'],
|
||||
domain: function(self){ return [['sale_ok','=',true],['available_in_pos','=',true]]; },
|
||||
@@ -720,7 +720,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
var self = this;
|
||||
var selectedOrder = this.get_order();
|
||||
//if(parsed_code.encoding === 'barcode'){
|
||||
var product = this.db.get_product_by_ean13(parsed_code.base_code);
|
||||
var product = this.db.get_product_by_barcode(parsed_code.base_code);
|
||||
/*}else if(parsed_code.encoding === 'reference'){
|
||||
var product = this.db.get_product_by_reference(parsed_code.code);
|
||||
}*/
|
||||
|
||||
@@ -174,12 +174,12 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
|
||||
// what happens when a cashier id barcode is scanned.
|
||||
// the default behavior is the following :
|
||||
// - if there's a user with a matching ean, put it as the active 'cashier', go to cashier mode, and return true
|
||||
// - if there's a user with a matching barcode, put it as the active 'cashier', go to cashier mode, and return true
|
||||
// - else : do nothing and return false. You probably want to extend this to show and appropriate error popup...
|
||||
barcode_cashier_action: function(code){
|
||||
var users = this.pos.users;
|
||||
for(var i = 0, len = users.length; i < len; i++){
|
||||
if(users[i].ean13 === code.code){
|
||||
if(users[i].barcode === code.code){
|
||||
this.pos.cashier = users[i];
|
||||
this.pos_widget.username.refresh();
|
||||
return true;
|
||||
@@ -191,10 +191,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
|
||||
// what happens when a client id barcode is scanned.
|
||||
// the default behavior is the following :
|
||||
// - if there's a user with a matching ean, put it as the active 'client' and return true
|
||||
// - if there's a user with a matching barcode, put it as the active 'client' and return true
|
||||
// - else : return false.
|
||||
barcode_client_action: function(code){
|
||||
var partner = this.pos.db.get_partner_by_ean13(code.code);
|
||||
var partner = this.pos.db.get_partner_by_barcode(code.code);
|
||||
if(partner){
|
||||
this.pos.get_order().set_client(partner);
|
||||
this.pos_widget.username.refresh();
|
||||
@@ -707,8 +707,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
barcode_client_action: function(code){
|
||||
if (this.editing_client) {
|
||||
this.$('.detail.barcode').val(code.code);
|
||||
} else if (this.pos.db.get_partner_by_ean13(code.code)) {
|
||||
this.display_client_details('show',this.pos.db.get_partner_by_ean13(code.code));
|
||||
} else if (this.pos.db.get_partner_by_barcode(code.code)) {
|
||||
this.display_client_details('show',this.pos.db.get_partner_by_barcode(code.code));
|
||||
}
|
||||
},
|
||||
perform_search: function(query, associate_result){
|
||||
@@ -841,7 +841,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
|
||||
fields.id = partner.id || false;
|
||||
fields.country_id = fields.country_id || false;
|
||||
fields.ean13 = fields.ean13 ? this.pos.barcode_reader.sanitize_ean(fields.ean13) : false;
|
||||
fields.barcode = fields.barcode ? this.pos.barcode_reader.sanitize_ean(fields.barcode) : false;
|
||||
|
||||
new instance.web.Model('res.partner').call('create_from_ui',[fields]).then(function(partner_id){
|
||||
self.saved_client_details(partner_id);
|
||||
|
||||
@@ -334,7 +334,7 @@
|
||||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Barcode</span>
|
||||
<input class='detail barcode' name='ean13' t-att-value='partner.ean13 || ""'></input>
|
||||
<input class='detail barcode' name='barcode' t-att-value='partner.barcode || ""'></input>
|
||||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Tax ID</span>
|
||||
@@ -376,10 +376,10 @@
|
||||
<div class='client-details-right'>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Barcode</span>
|
||||
<t t-if='partner.ean13'>
|
||||
<span class='detail client-id'><t t-esc='partner.ean13'/></span>
|
||||
<t t-if='partner.barcode'>
|
||||
<span class='detail client-id'><t t-esc='partner.barcode'/></span>
|
||||
</t>
|
||||
<t t-if='!partner.ean13'>
|
||||
<t t-if='!partner.barcode'>
|
||||
<span class='detail client-id empty'>N/A</span>
|
||||
</t>
|
||||
</div>
|
||||
|
||||
@@ -572,7 +572,7 @@ class product_template(osv.osv):
|
||||
'product_variant_count': fields.function( _get_product_variant_count, type='integer', string='# of Product Variants'),
|
||||
|
||||
# related to display product product information if is_product_variant
|
||||
'ean13': fields.related('product_variant_ids', 'ean13', type='char', string='Barcode'),
|
||||
'barcode': fields.related('product_variant_ids', 'barcode', type='char', string='Barcode', oldname='ean13'),
|
||||
'default_code': fields.related('product_variant_ids', 'default_code', type='char', string='Internal Reference'),
|
||||
}
|
||||
|
||||
@@ -703,8 +703,8 @@ class product_template(osv.osv):
|
||||
# TODO: this is needed to set given values to first variant after creation
|
||||
# these fields should be moved to product as lead to confusion
|
||||
related_vals = {}
|
||||
if vals.get('ean13'):
|
||||
related_vals['ean13'] = vals['ean13']
|
||||
if vals.get('barcode'):
|
||||
related_vals['barcode'] = vals['barcode']
|
||||
if vals.get('default_code'):
|
||||
related_vals['default_code'] = vals['default_code']
|
||||
if related_vals:
|
||||
@@ -922,7 +922,7 @@ class product_product(osv.osv):
|
||||
'default_code' : fields.char('Internal Reference', select=True),
|
||||
'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the product without removing it."),
|
||||
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True, auto_join=True),
|
||||
'ean13': fields.char('Barcode', help="International Article Number used for product identification."),
|
||||
'barcode': fields.char('Barcode', help="International Article Number used for product identification.", oldname='ean13'),
|
||||
'name_template': fields.related('product_tmpl_id', 'name', string="Template Name", type='char', store={
|
||||
'product.template': (_get_name_template_ids, ['name'], 10),
|
||||
'product.product': (lambda self, cr, uid, ids, c=None: ids, [], 10),
|
||||
@@ -979,14 +979,6 @@ class product_product(osv.osv):
|
||||
return {'value': {'uom_po_id': uom_id}}
|
||||
return False
|
||||
|
||||
# def _check_ean_key(self, cr, uid, ids, context=None):
|
||||
# for product in self.read(cr, uid, ids, ['ean13'], context=context):
|
||||
# if not check_ean(product['ean13']):
|
||||
# return False
|
||||
# return True
|
||||
#
|
||||
#_constraints = [(_check_ean_key, 'You provided an invalid "EAN13 Barcode" reference. You may use the "Internal Reference" field instead.', ['ean13'])]
|
||||
|
||||
def on_order(self, cr, uid, ids, orderline, quantity):
|
||||
pass
|
||||
|
||||
@@ -1052,7 +1044,7 @@ class product_product(osv.osv):
|
||||
if operator in positive_operators:
|
||||
ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context)
|
||||
ids = self.search(cr, user, [('barcode','=',name)]+ args, limit=limit, context=context)
|
||||
if not ids and operator not in expression.NEGATIVE_TERM_OPERATORS:
|
||||
# Do not merge the 2 next lines into one single search, SQL search performance would be abysmal
|
||||
# on a database with thousands of matching products, due to the huge merge+unique needed for the
|
||||
@@ -1166,7 +1158,7 @@ class product_product(osv.osv):
|
||||
class product_packaging(osv.osv):
|
||||
_name = "product.packaging"
|
||||
_description = "Packaging"
|
||||
_rec_name = 'ean'
|
||||
_rec_name = 'barcode'
|
||||
_order = 'sequence'
|
||||
_columns = {
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of packaging."),
|
||||
@@ -1179,7 +1171,7 @@ class product_packaging(osv.osv):
|
||||
'rows' : fields.integer('Number of Layers', required=True,
|
||||
help='The number of layers on a pallet or box'),
|
||||
'product_tmpl_id' : fields.many2one('product.template', 'Product', select=1, ondelete='cascade', required=True),
|
||||
'ean' : fields.char('Barcode', help="The Barcode of the package unit."),
|
||||
'barcode' : fields.char('Barcode', help="The Barcode of the package unit.", oldname="ean"),
|
||||
'code' : fields.char('Code', help="The code of the transport unit."),
|
||||
'weight': fields.float('Total Package Weight',
|
||||
help='The weight of a full package, pallet or box.'),
|
||||
@@ -1198,7 +1190,7 @@ class product_packaging(osv.osv):
|
||||
return []
|
||||
res = []
|
||||
for pckg in self.browse(cr, uid, ids, context=context):
|
||||
p_name = pckg.ean and '[' + pckg.ean + '] ' or ''
|
||||
p_name = pckg.barcode and '[' + pckg.barcode + '] ' or ''
|
||||
p_name += pckg.ul.name
|
||||
res.append((pckg.id,p_name))
|
||||
return res
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
<attribute name="name">Product Template</attribute>
|
||||
</xpath>
|
||||
<field name="active" position="after">
|
||||
<field name="ean13" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
|
||||
<field name="barcode" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
|
||||
<field name="default_code" attrs="{'invisible': [('product_variant_count', '>', 1)]}"/>
|
||||
</field>
|
||||
<xpath expr="//page[@string='Sales']" position="after">
|
||||
@@ -341,7 +341,7 @@
|
||||
<field name="lst_price"/>
|
||||
<field name="price" invisible="not context.get('pricelist',False)"/>
|
||||
<field name="uom_id"/>
|
||||
<field name="ean13"/>
|
||||
<field name="barcode"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="product_tmpl_id" invisible="1"/>
|
||||
</tree>
|
||||
@@ -359,7 +359,7 @@
|
||||
<attribute name="string">Product Variant</attribute>
|
||||
</form>
|
||||
<field name="active" position="after">
|
||||
<field name="ean13"/>
|
||||
<field name="barcode"/>
|
||||
<field name="default_code"/>
|
||||
</field>
|
||||
<field name="list_price" position="attributes">
|
||||
@@ -733,7 +733,7 @@
|
||||
<tree string="Packaging">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="product_tmpl_id"/>
|
||||
<field name="ean"/>
|
||||
<field name="barcode"/>
|
||||
<field name="qty"/>
|
||||
<field name="ul"/>
|
||||
<field name="ul_container"/>
|
||||
@@ -763,7 +763,7 @@
|
||||
<group col="4">
|
||||
<field name="product_tmpl_id"/>
|
||||
<newline/>
|
||||
<field name="ean"/>
|
||||
<field name="barcode"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
<newline/>
|
||||
<field name="qty"/>
|
||||
@@ -786,7 +786,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Packaging">
|
||||
<group col="4">
|
||||
<field name="ean"/>
|
||||
<field name="barcode"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
<newline/>
|
||||
<field name="qty"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<product type="field" name="name"/>
|
||||
<variant type="field" name="attribute_value_ids"/>
|
||||
<price type="field" name="list_price"/>
|
||||
<ean13 type="field" name="ean13"/>
|
||||
<barcode type="field" name="barcode"/>
|
||||
<currency type="field" name="company_id.currency_id.name"/>
|
||||
</lot-line>
|
||||
</lots>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<barCode><xsl:value-of select="ean13" /></barCode>
|
||||
<barCode><xsl:value-of select="barcode" /></barCode>
|
||||
</td>
|
||||
<td>
|
||||
<para style="nospace"><xsl:value-of select="substring(product, 1, pmaxChars)"/></para><xsl:text>, </xsl:text>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<field name="removal_time">6</field>
|
||||
<field name="alert_time">5</field>
|
||||
<field name="default_code">JKB</field>
|
||||
<field name="ean13">3307630302014</field>
|
||||
<field name="barcode">3307630302014</field>
|
||||
<field name="categ_id" search="[]" model="product.category"/>
|
||||
<field name="image" type="base64" file="product_expiry/static/img/product_product_jambon-image.jpg"/>
|
||||
</record>
|
||||
@@ -27,7 +27,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_tmpl_id" ref="product_product_jambon_product_template" />
|
||||
<field name="ean"></field>
|
||||
<field name="barcode"></field>
|
||||
<field name="weight">10</field>
|
||||
</record>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<field name="removal_time">20</field>
|
||||
<field name="alert_time">19</field>
|
||||
<field name="default_code">FKS</field>
|
||||
<field name="ean13">3307631101876</field>
|
||||
<field name="barcode">3307631101876</field>
|
||||
<field name="categ_id" search="[]" model="product.category"/>
|
||||
<field name="image" type="base64" file="product_expiry/static/img/product_product_from-image.jpg"/>
|
||||
</record>
|
||||
@@ -55,7 +55,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_tmpl_id" ref="product_product_from_product_template" />
|
||||
<field name="ean"></field>
|
||||
<field name="barcode"></field>
|
||||
<field name="weight">10</field>
|
||||
</record>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<field name="removal_time">20</field>
|
||||
<field name="alert_time">19</field>
|
||||
<field name="default_code">PKB</field>
|
||||
<field name="ean13">3307631102323</field>
|
||||
<field name="barcode">3307631102323</field>
|
||||
<field name="categ_id" search="[]" model="product.category"/>
|
||||
<field name="image" type="base64" file="product_expiry/static/img/product_product_pain-image.jpg"/>
|
||||
</record>
|
||||
@@ -83,7 +83,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_tmpl_id" ref="product_product_pain_product_template" />
|
||||
<field name="ean"></field>
|
||||
<field name="barcode"></field>
|
||||
<field name="weight">10</field>
|
||||
</record>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<field name="removal_time">20</field>
|
||||
<field name="alert_time">19</field>
|
||||
<field name="default_code">LEX</field>
|
||||
<field name="ean13">3307630302045</field>
|
||||
<field name="barcode">3307630302045</field>
|
||||
<field name="categ_id" search="[]" model="product.category"/>
|
||||
<field name="image" type="base64" file="product_expiry/static/img/product_product_lait-image.jpg"/>
|
||||
</record>
|
||||
@@ -111,7 +111,7 @@
|
||||
<field name="ul_qty">6</field>
|
||||
<field name="rows">4</field>
|
||||
<field name="product_tmpl_id" ref="product_product_lait_product_template" />
|
||||
<field name="ean"></field>
|
||||
<field name="barcode"></field>
|
||||
<field name="weight">10</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
@@ -263,15 +263,15 @@ class sale_order_line(osv.osv):
|
||||
q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
|
||||
# qty = qty - qty % q + q
|
||||
if qty and (q and not (qty % q) == 0):
|
||||
ean = pack.ean or _('(n/a)')
|
||||
barcode = pack.barcode or _('(n/a)')
|
||||
qty_pack = pack.qty
|
||||
type_ul = pack.ul
|
||||
if not warning_msgs:
|
||||
warn_msg = _("You selected a quantity of %d Units.\n"
|
||||
"But it's not compatible with the selected packaging.\n"
|
||||
"Here is a proposition of quantities according to the packaging:\n"
|
||||
"EAN: %s Quantity: %s Type of ul: %s") % \
|
||||
(qty, ean, qty_pack, type_ul.name)
|
||||
"Barcode: %s Quantity: %s Type of ul: %s") % \
|
||||
(qty, barcode, qty_pack, type_ul.name)
|
||||
warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n"
|
||||
warning = {
|
||||
'title': _('Configuration Error!'),
|
||||
|
||||
@@ -1464,12 +1464,12 @@ class stock_picking(osv.osv):
|
||||
if parsed_result['type'] in ['weight', 'product', 'package']:
|
||||
weight=-1
|
||||
if parsed_result['type'] == 'weight':
|
||||
domain = ['|', ('ean13', '=', parsed_result['base_code']), ('default_code', '=', parsed_result['base_code'])]
|
||||
domain = ['|', ('barcode', '=', parsed_result['base_code']), ('default_code', '=', parsed_result['base_code'])]
|
||||
weight=parsed_result['value']
|
||||
obj = self.pool.get('product.product')
|
||||
id_in_operation = 'product_id'
|
||||
elif parsed_result['type'] == 'product':
|
||||
domain = ['|', ('ean13', '=', parsed_result['code']), ('default_code', '=', parsed_result['code'])]
|
||||
domain = ['|', ('barcode', '=', parsed_result['code']), ('default_code', '=', parsed_result['code'])]
|
||||
obj = self.pool.get('product.product')
|
||||
id_in_operation = 'product_id'
|
||||
else:
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
<td class="text-right"><span t-field="move.product_uom_qty"/> <span t-field="move.product_uom" groups="product.group_uom"/></td>
|
||||
<t t-if="o.picking_type_id.code != 'incoming'"><td><span t-field="move.location_id"/></td></t>
|
||||
<td>
|
||||
<span t-if="move.product_id and move.product_id.ean13">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', move.product_id.ean13, 600, 100)" style="width:300px;height:50px"/>
|
||||
<span t-if="move.product_id and move.product_id.barcode">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Barcode', move.product_id.barcode, 600, 100)" style="width:300px;height:50px"/>
|
||||
</span>
|
||||
</td>
|
||||
<t t-if="o.picking_type_id.code != 'outgoing'"><td><span t-field="move.location_dest_id"/></td></t>
|
||||
@@ -106,8 +106,8 @@
|
||||
<span t-if="pack_operation.lot_id">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', pack_operation.lot_id.name, 600, 100)" style="width:300px;height:50px"/>
|
||||
</span>
|
||||
<span t-if="pack_operation.product_id and not pack_operation.lot_id and pack_operation.product_id.ean13">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', pack_operation.product_id.ean13, 600, 100)" style="width:300px;height:50px"/>
|
||||
<span t-if="pack_operation.product_id and not pack_operation.lot_id and pack_operation.product_id.barcode">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Barcode', pack_operation.product_id.barcode, 600, 100)" style="width:300px;height:50px"/>
|
||||
</span>
|
||||
<span t-if="pack_operation.package_id and not pack_operation.product_id">
|
||||
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', pack_operation.package_id.name, 600, 100)" style="width:300px;height:50px"/>
|
||||
|
||||
@@ -250,7 +250,7 @@ class res_partner(osv.Model, format_address):
|
||||
'comment': fields.text('Notes'),
|
||||
'category_id': fields.many2many('res.partner.category', id1='partner_id', id2='category_id', string='Tags'),
|
||||
'credit_limit': fields.float(string='Credit Limit'),
|
||||
'ean13': fields.char('EAN13', size=13),
|
||||
'barcode': fields.char('Barcode', oldname='ean13'),
|
||||
'active': fields.boolean('Active'),
|
||||
'customer': fields.boolean('Is a Customer', help="Check this box if this contact is a customer."),
|
||||
'supplier': fields.boolean('Is a Supplier', help="Check this box if this contact is a supplier. If it's not checked, purchase people will not see it when encoding a purchase order."),
|
||||
@@ -395,21 +395,21 @@ class res_partner(osv.Model, format_address):
|
||||
return {'value': {'country_id': state.country_id.id}}
|
||||
return {}
|
||||
|
||||
def _check_ean_key(self, cr, uid, ids, context=None):
|
||||
for partner_o in self.pool['res.partner'].read(cr, uid, ids, ['ean13',]):
|
||||
thisean=partner_o['ean13']
|
||||
if thisean and thisean!='':
|
||||
if len(thisean)!=13:
|
||||
return False
|
||||
sum=0
|
||||
for i in range(12):
|
||||
if not (i % 2):
|
||||
sum+=int(thisean[i])
|
||||
else:
|
||||
sum+=3*int(thisean[i])
|
||||
if math.ceil(sum/10.0)*10-sum!=int(thisean[12]):
|
||||
return False
|
||||
return True
|
||||
# def _check_ean_key(self, cr, uid, ids, context=None):
|
||||
# for partner_o in self.pool['res.partner'].read(cr, uid, ids, ['barcode',]):
|
||||
# thisean=partner_o['barcode']
|
||||
# if thisean and thisean!='':
|
||||
# if len(thisean)!=13:
|
||||
# return False
|
||||
# sum=0
|
||||
# for i in range(12):
|
||||
# if not (i % 2):
|
||||
# sum+=int(thisean[i])
|
||||
# else:
|
||||
# sum+=3*int(thisean[i])
|
||||
# if math.ceil(sum/10.0)*10-sum!=int(thisean[12]):
|
||||
# return False
|
||||
# return True
|
||||
|
||||
# _constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean13'])]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user