Odoo Help

Welcome!

This community 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.

1

How to have this field condition?

By
eric machine
on 5/7/13, 12:14 PM 1,542 views

Hi everyone,

I tried this post tips here https://accounts.openerp.com/forum/Help-1/question/13042

It works for me as below

<field name="x_is_family_coverage" string="Is Family Coverage?"> </field>
                                   <field name="x_eb_partner_name" attrs="{'invisible':[('x_is_family_coverage', '==', False)]}"> </field>
                                   <field name="x_eb_partner_eb_no" attrs="{'invisible':[('x_is_family_coverage', '==', False)]}"> </field>

But what if when I check the "Is Family Coverage?" checkbox, I also want to make the fields x_eb_partner_name and x_eb_partner_eb_no required/compulsory too? If uncheck the "Is Family Coverage?" checkbox, then both fields are not required.

Any idea? Thanks.

1

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/7/13, 12:28 PM
attrs="{'invisible':[('x_is_family_coverage', '==', False)],'required':[('x_is_family_coverage', '==', False)]}"
0

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 5/7/13, 12:28 PM

The attrs can be indicates all in the some dictonary:

<field name="x_eb_partner_name" attrs="{'invisible':[('x_is_family_coverage', '=', False)], 'required':[('x_is_family_coverage', '=', False)]}" />

If I have understand.

Thanks :) I will give that a try :) But I assume this is the right way to add conditional to the field xml directly? Or is it better I duplicate a module and start writing python codes? which one is better?

eric machine
on 5/7/13, 9:35 PM

I prefer to use this type of filter in xml code, so if someone inherit my module can change them in a simple way.

Francesco OpenCode
on 5/8/13, 4:53 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/7/13, 12:14 PM
Seen: 1542 times
Last updated: 8/25/15, 3:07 PM