Odoo Help

Welcome!

This community 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.

1

Change Internal Reference to unique

By
Adrian
on 9/30/14, 4:31 AM 750 views

How can I change that the Internal Reference of the Products in Warehouse is an unique value?

1
Adrian
On 10/3/14, 2:03 AM

Thanks for you answer. I managed to make the value unique by inheriting the product module. This page explains how to write a costum module http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7.

Here the python file (if someone wants to do the same):

from openerp.osv import fields, osv

class unique_reference(osv.osv):

   _inherit = "product.product"

   _sql_constraints = [
        ('uniq_defaut_code', 'unique(default_code)', "A external reference already exists with this name . External reference must be unique!"),
   ]

unique_reference()

 

0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 9/30/14, 6:10 AM

You need to add some custom code, inheriting the product module and adding a constraint to the field. That will make it unique, even with a small message telling the user their input should be unique.

By default I don't think there is any module that does this for you, although I would be happy to proven wrong.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 9/30/14, 4:31 AM
Seen: 750 times
Last updated: 3/16/15, 8:10 AM