How to create a custom field with Yes/No Option
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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.
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)]}"/>
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.