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.

0

Autocomplete product field (many2one?)

By
tudor
on 8/12/15, 1:49 AM 482 views

I'm trying to make a product field (internal reference - default_code) display a list of already entered references while typing. More exactly, I would like that when I start typing a new 'reference' to have a list displayed with previously entered 'references' that match what I have typed so far. Something like the Customers -> Create -> Company name field.

I'm a beginner with odoo and i can't figure it out how to change the default_code field. From what i've seen on the forum I suspect that i need to make it a many2one field. I tried a few ideas, but none of them work.

Thank you for the help.

1

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 8/12/15, 2:12 AM

Tudor,

Having a display of pre-existent record, is using the foreign key in Db. In Odoo, we call it many2one, Referring to the another table.

The default code is a character field and hence its an 'input' freetext from end user. So, its hard for you to straight away to display previous entries.

In order to make a many2one field, you can make a model called product.code. Add fields like name and code! Convert the field of default_code to many2one referring to product.code. You can refer to the source code of product.uom model and closely reuse the functionality you want.

For the detailed understanding of Odoo, you may refer to doc.odoo.com and Udemy's self-paced online technical training.

Thanks.

0
tudor
On 8/14/15, 5:04 AM

Thank you very much for the answer. I was able to do it in the end, based on your info.

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

1 follower(s)

Stats

Asked: 8/12/15, 1:49 AM
Seen: 482 times
Last updated: 8/14/15, 5:04 AM