This question has been flagged
5 Replies
3283 Views

How to edit the combobox items

Avatar
Discard

What do you mean? Can you please explain little more?

Author

I have a combobox whit only one option; how can i add more options? I'm in developer mode

<select>

<option value="Select">Select....</option>

<option value="java">Java</option>

<option value="html">HTML</option>

<option value="C++">C++</option>

<option value="sap">SAP</option>

</select>

Best Answer

You can't add more combo-box options from the developer mode menu..You can make a new module in your addons directory and add this to your python code .​

....

from odoo import fields,models,api

class example (models.Model):
         #inherit the model that has your combo box you can find it if you clicked edit form view
         #in your developer mode menu

         _inherit = "your_model"

         #then write your combobox field name like below and add the same option you had and add more if you want
         #>> this will overwrite the field with the new value
         your_combobox_field_name = fields.Selection([
            ('option1', 'Option 1'),
            ('option2', 'Option 2'),
         ], string='String to display', default='option1')

....

Avatar
Discard
Best Answer

Static or dynamic (based on other model) ?

Avatar
Discard