how to add Unique barcode number on product in order to avoid having 2 different product with the same barcode number
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
product->product.py
find class product.product add following code line no 588
_sql_constraints = [
('unique_product_barcode', 'unique(ean13)', 'Product Bar-Code Must Be Unique .'),
]
upgrade this module Restart your server Settings->Installed Modules->find Products & Pricelists upgrade
OR
if you want to create separate module for this one follow this step
create one folder name should like
unique_product_barcode
inside this folder add __init__.py , __openerp__.py and yourmodule.py file
1) __init__.py
import unique_product
2) __openerp__.py
{
'name': 'Product Unique Barcode',
'version': '1.1',
'author': 'Husam',
'category': 'Sales Management',
'depends': ['base', 'process', 'decimal_precision', 'mail'],
'description': """
Unique Barcode of Product
""",
'data': [],
'installable': True,
'auto_install': False, }
3) unique_product.py
from openerp.osv import fields,osv
class product_product(osv.osv):
_inherit = 'product.product'
_sql_constraints = [
('unique_product_barcode', 'unique(ean13)', 'Product Bar-Code Must Be Unique .'),
]
product_product()
Restart Your OpenERP Go to Settings->Install Modules->find unique_product_barcode and install
ur a master alot of thanks
I have added these modules, but am unable to view it when updating the module list?
Add Unique Constraints in python file.
Create custom module
For Example create addons/barcode_unique Module
1) __init__.py file
import product
2) __openerp__.py file
{
"name" : "Product Barcode Unique",
"version" : "0.1",
"category": '',
"description" : "Product",
"author" : "ERP",
"depends" : ["product"],
"init_xml" : [],
"update_xml" : [],
"data": [],
"css": [],
"installable" : True,
"active" : False,
}
1) Create Product.py File add the below code
class product_product(osv.osv):
_inherit = "product.product"
_sql_constraints = [
('barcode_uniq', 'unique(ean13)', 'Bar-code No must be unique !'),
]
Create the above Module and Install in openerp
many thanks
Thank you so much for your reply, but which python file, can you provide path?
I updated my answer