Odoo Help

0

Why invisible field can't work

By
heru
on 1/2/15, 4:22 AM 1,357 views

Hai , 

i want to question ...

Why invisible field can't work, 

I will to invisible field 'birth_date' when I choose customer (with type field is boolean) ...

eg :

I make code in file .py :

'customer': fields.boolean('Customer'),

'birth_date':fields.date('Birth Date'),

 

and , make code in file .xml :

<record model="ir.ui.view" id="res_partner_formTop2_view">
            <field name="name">Position Top2</field>            
            <field name="model">res.partner</field>            
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <field name="function" position="before">
                    <field name="customer"/>
                </field>
            </field>
        </record>

 

<record model="ir.ui.view" id="res_partner_form5_view">
            <field name="name">master customer</field>            
            <field name="model">res.partner</field>            
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <field name="phone" position="before">
                    <field name="birth_date" attrs="{'invisible': [('customer','!=', True)]}"/>
                </field>
            </field>
        </record>

how I fix my problem ?

Does it get invisible when the check box "customer" is not selected? I think you should write as {'invisible':[('customer','=',True)]}. So when you will select the check box it will invisible the field.

Emipro Technologies Pvt. Ltd.
on 1/2/15, 4:39 AM

Ok thanks Emipro Technologies Pvt. Ltd, I want to try your suggestion

heru
on 1/5/15, 11:30 PM
2
aci aisha
On 1/16/15, 5:09 AM

<field name="function" position="replace"/>
<!-- Add the field again at desired position -->
<field name="function" position="before">
    <field name="customer"/>
</field>

1

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11456
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
On 1/2/15, 4:31 PM

Hello Heru,

I guess you have same customer field twice in your partner form. Existing field you can see in Sales & Purchases tab. So syste gets confuse which one to consider.

So if you want to change the position of the field, you should first replace it and then add that field again with desired position.

Try following code:

<!-- Replace existing one first -->
<field name="function" position="replace"/>
<!-- Add the field again at desired position -->
<field name="function" position="before">
    <field name="customer"/>
</field>

customer boolean field is already defined in base module, so you don't have to define it again.

Ok thanks Sudhir Arya, I want to try your suggestion

heru
on 1/5/15, 11:31 PM

Did it work?

Sudhir Arya (ERP Harbor Consulting Services)
on 1/9/15, 6:53 AM

yes, it's work ... thanks Sudhir .. Sudhir, can you help me, what I use method when we fill field in form, but automatic filled in another form . ex : i have 1 field (engine number) is same in 2 form ('Work Order', 'Picking Slip'). i fill field 'engine number' in form 'Work Order' , when i click button save, field 'engine number' in form 'Picking Slip' automatic is filled.

heru
on 1/13/15, 6:33 PM

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

2 follower(s)

Stats

Asked: 1/2/15, 4:22 AM
Seen: 1357 times
Last updated: 3/16/15, 8:10 AM