Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
5 Antwoorden
3884 Weergaven

How to edit the combobox items

Avatar
Annuleer

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

Auteur

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>

Beste antwoord

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
Annuleer
Beste antwoord

Static or dynamic (based on other model) ?

Avatar
Annuleer