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.

0

View invisible fields shown with defaults?

By
Matias Garcia Isaia
on 7/26/13, 6:29 PM 2,560 views

I've modified a view so some fields aren't shown when a given field is disabled (particularly, is_company from res.partner).

I've made a custom view that only shows Customers, and in my domain they're only Companies (there can never be a Person as a Customer). I've set 'default_is_company' : 0 in the action's context, but when I try to create a new Client (pressing the Create button), the fields that should be hidden are shown.

    <record id="view_partner_address_form1_inherit" model="ir.ui.view">
        <field name="name">res.partner.address.form1.inherit</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="arch" type="xml">
                <div class="oe_edit_only" position="replace">
                    <div class="oe_edit_only">
                        <label for="name"/>
                        <field name="is_company" invisible="True" on_change="onchange_type(is_company)" class="oe_inline"/>
                    </div>
                </div>
                <field name="function" position="after">
                    <field name="birthplace" attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"/>
                    <field name="birthday" attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"/>
                </field>
          </field>
    </record>


    <record id="action_partner_form_inherit_customer" model="ir.actions.act_window">
        <field name="name">Customers</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">res.partner</field>
        <field name="view_type">form</field>
        <field name="view_mode">kanban,form,tree</field>
        <field name="context">{ 'search_default_customer':1, 'default_customer':1, 'default_is_company':1 }</field>
        <field name="search_view_id" ref="base.view_res_partner_filter"/>
    </record>

__IMAGE LINK:__ http :// i43.tinypic.com/28cn8s0.png

If I edit an existing entity (even a new one created with this buggy form), the fields are correctly hidden.

Any idea what's wrong with this?

I'm using OpenERP 7.0-20130623-231037, in Spanish as you can see.

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: 7/26/13, 6:29 PM
Seen: 2560 times
Last updated: 3/16/15, 8:10 AM