This question has been flagged
4 Replies
9897 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.

Avatar
Discard
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?

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

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


Best Answer

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.

Avatar
Discard
Best Answer

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

Avatar
Discard