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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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.
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.
'field_name': fields.selection('table_name','String',required=True),
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
Self hosting Odoo custom
Resuelto
|
|
1
ago 24
|
1018 | |
|
3
feb 23
|
2900 | ||
|
0
jul 20
|
2461 | ||
|
13
mar 16
|
4779 | ||
|
1
sept 15
|
5514 |
No, No need to use any widget. Just add this field into .xml. It will work as like normal selection field.