Odoo Help

0

How to create Dropdown list in a custom module and the values for dropdownlist fetches from database?

By
yogesh
on 3/24/15, 6:49 AM 2,293 views

Hello every one,

I created the custom module and i want to add the dropdown list and values for that dropdownlist fetches from the particular field in the database.

kindly give some ideas.

Thanks for the valuable answer.
How to define this field in the XML file.
Should we use any widget?



On Tue, Mar 24, 2015 at 5:09 PM, Emipro Technologies Pvt. Ltd. <erp@emiprotechnologies.com> wrote:

A new answer for How to create Dropdown list in a custom module and the values for dropdownlist fetches from database? has been posted. Click here to access the post.

Emipro Technologies is best in Odoo & eCommerce Application development based outsourcing software firm. We deliver any kind of complex solutions in the domain of Odoo and eCommerce to customers accross the globe. Being in IT business since 2011, We have a strong team of skilled experienced IT experts.Our customers are companies of all sizes ranging from startups to large enterprises who realize that they need a professional internet solution to generate revenue streams, establish communication channels or streamline business operations.

Our Services in Odoo includes,
  • Installation
  • Customization
  • Configuration
  • Software Training
  • After Sale Support
  • Maintenance
  • Consulting
Contact info@emiprotechnologies.com for any kind of queries in Odoo. Visit www.emiprotechnologies.com for more details.




 

Sent by Odoo S.A. using Odoo about Forum Post How to create Dropdown list in a custom module and the values for dropdownlist fetches from database?

yogesh
on 3/24/15, 8:41 AM

No, No need to use any widget. Just add this field into .xml. It will work as like normal selection field.

Emipro Technologies Pvt. Ltd.
on 3/24/15, 9:09 AM
Thanks for the answer.
I want to dynamically bring the values from one of the field of same module.
Please let me know your comments.

On Wed, Mar 25, 2015 at 11:32 AM, YOGESH E <yogeshitprof@gmail.com> wrote:
Thanks for the answer.
I want to dynamically bring the values from one of the field of same module.
Please let me know your comments.

Regards,
YOGESH 

On Wed, Mar 25, 2015 at 11:28 AM, Alby Antony <albyantony23@gmail.com> wrote:

A new answer for How to create Dropdown list in a custom module and the values for dropdownlist fetches from database? has been posted. Click here to access the post.

--
Alby Antony


yogesh
on 3/25/15, 2:13 AM
2

Hi,

You can see this type of custom dropdownlist (selection) into pricelist file of product module. It looks like below.


def _price_field_get(self, cr, uid, context=None):

mf = self.pool.get('ir.model.fields')

ids = mf.search(cr, uid, [('model','in', (('product.product'),('product.template'))), ('ttype','=','float')], context=context)

res = []

for field in mf.browse(cr, uid, ids, context=context):

res.append((field.name, field.field_description))

return res

_columns = {

"field" : fields.selection(_price_field_get, "Product Field", size=32, required=True, help="Associated field in the product form."),

}

Here 'field' is selection and its data is comes dynamic from the method "_price_field_get".

I hope you will get custom dropdownlist.

1
Alby Antony
On 3/25/15, 1:58 AM

'field_name': fields.selection('table_name','String',required=True),

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.

Register

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

2 follower(s)

Stats

Asked: 3/24/15, 6:49 AM
Seen: 2293 times
Last updated: 3/25/15, 2:15 AM