Odoo Help


What is the problem i face, If i remove the sql constraint for EAN13 field in product creation form?

on 8/21/14, 9:45 AM 1,081 views

In product creation form EAN13 barcode field is there. For this one sql constraint is there to check the format of ean13. I want to use this field, not only for ean13 also for other barcode formats. Please give me a solution. In my point of view, i want to remove the constraint. Please correct me if i am wrong.

files to replace the ean13 field in product.py.

.py files

from openerp.osv import fields, osv
import os.path
import fnmatch
from tools.translate import _

class product_extension(osv.osv):
    _inherit = "product.product"
    _columns = {
    'ean13': fields.char('Barcode', size=256, help="International Article Number used for product identification."),
    def _check_ean_key(self, cr, uid, ids, context=None):
            return True

    _constraints = [(_check_ean_key, 'You provided an invalid "EAN13 Barcode" reference. You may use the "Internal Reference" field instead.', ['ean13'])]


.xml file

<record id="product_normal_form_view_extension_form1" model="ir.ui.view">
            <field name="name">product.normal.form.view.extension.form1</field>
            <field name="model">product.product</field>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                    <xpath expr="/form/sheet/notebook/page/group/group[2]/div/field[@name='ean13']" position="replace">
                        <field name="ean13" />



Med Said BARA

--Med Said BARA--

| 5 5 7
--Med Said BARA--
Med Said BARA
On 8/21/14, 12:52 PM

Thank you Med Said BARA, i got one problem. For example product p1 has upc code=12345, converted ean13 code 1234500000003, this code store in database. when i try to search with the code 12345 the required product not getting search.

on 8/22/14, 5:14 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/21/14, 9:45 AM
Seen: 1081 times
Last updated: 3/16/15, 8:10 AM