Odoo Help

0

Custom Fields as a drop down

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

How to create a custom field with Yes/No Option

1
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 :-

<odoo>

    <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">

                <group>

                    <group>

                        <field name="exist_project" />
                    </group>

                </group>   

            </xpath>

        </field>

    </record>

</odoo>


Hope this works for you. 


0
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)]}"/>

0
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.

Register

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)

Stats

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