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):
<?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>
<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" />
<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" />
<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" />
<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" />
<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>
<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>
<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"/>
<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"/>
<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>
<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>
<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>
<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>
<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>
<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>
</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>
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'),
+ }
\ No newline at end of file
<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>
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'],),
- # ]
-
<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>
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;
this.category_search_string = {};
this.packagings_by_id = {};
this.packagings_by_product_tmpl_id = {};
- this.packagings_by_ean13 = {};
+ this.packagings_by_barcode = {};
},
/*
},
_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(':','');
}
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';
},
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;
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;
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 || '') +' '+
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;
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]];
}
},
/* 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 {
}
},{
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;
},
},{
model: 'product.packaging',
- fields: ['ean','product_tmpl_id'],
+ fields: ['barcode','product_tmpl_id'],
domain: null,
loaded: function(self, packagings){
self.db.add_packagings(packagings);
},
},{
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]]; },
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);
}*/
// 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;
// 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();
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){
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);
</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>
<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>
'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'),
}
# 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:
'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),
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
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
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."),
'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.'),
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
<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">
<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>
<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">
<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"/>
<group col="4">
<field name="product_tmpl_id"/>
<newline/>
- <field name="ean"/>
+ <field name="barcode"/>
<field name="sequence" invisible="1"/>
<newline/>
<field name="qty"/>
<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"/>
<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>
</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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
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!'),
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:
<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>
<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"/>
'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."),
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'])]