Odoo Help


Custom Fields as a drop down

Senthil Kumar
on 12/21/15, 12:33 AM 606 views

How to create a custom field with Yes/No Option

--Jignesh Mehta--

Jignesh Mehta
On 12/21/15, 1:33 AM

Hello Senthil,

Try below code which is used in my Project Module.

custom_project.py :-

class project(models.Model):

    _inherit = 'project.project'

     exist_project = fields.Selection([('yes','Yes'),('no','No')], string="Is existing project ?")

custom_project_view.xml :-


    <record model="ir.ui.view" id="project_inherit_form">

        <field name="name">project.inherit.form</field>

        <field name="model">project.project</field>

        <field name="inherit_id" ref="project.edit_project"/>

        <field name="arch" type="xml">    

            <xpath expr="/form/sheet/div[@class='oe_title']/div[@name='options_active']" position="after">



                        <field name="exist_project" />






Hope this works for you. 

Krupesh Laiya
On 12/21/15, 3:55 AM

You can add attrs for that if you don't want to see in supplier then you have to user this attrs:

 <field name="exist_project" attrs="{'invisible': [('supplier', '=', True)]}"/>

Senthil Kumar
On 12/21/15, 1:38 AM

Thank you Jignesh. When ever I add a custom field in customer master, the same fields are getting displayed in supplier master also. How do I make it visible only in customer master??

given ans on the question which is asked by you.

Jignesh Mehta
on 12/21/15, 1:41 AM

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.


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

1 follower(s)


Asked: 12/21/15, 12:33 AM
Seen: 606 times
Last updated: 12/21/15, 3:55 AM