Skip to content

Duplicate fields in view == bugged view #4

Open
@oerp-odoo

Description

@oerp-odoo

You can't use such view definitions like this (project.project view):

                <field name="user_id" position="replace">
                    <field name="user_id" string="Scrum Master" attrs="{'invisible': [('use_scrum', '=', False)]}"/>
                    <field name="user_id" string="Project Manager" attrs="{'invisible': [('use_scrum', '=', True)]}"/>
                </field>
                <field name="partner_id" position="replace">
                    <field name="partner_id" string="Product Owner" attrs="{'invisible': [('use_scrum', '=', False)]}"/>
                    <field name="partner_id" string="Customer" attrs="{'invisible': [('use_scrum', '=', True)]}"/>
                </field>

When you use same field twice on view, view gets bugged (does not matter if that field is hidden when another is visible) in way that values are actually not saved on those fields. When you go to same project again, those fields won't be filled, even though you filled it.

You can see how it is bugged in this video:
https://vid.me/niae

But you can you "duplicate" labels to get similar results without bugging view. For example like this:

                <field name="user_id" position="replace">
                    <label for="user_id" attrs="{'invisible': [('use_scrum', '=', True)]}"/>
                    <label for="user_id" string="Scrum Master" attrs="{'invisible': [('use_scrum', '=', False)]}"/>
                    <div>
                        <field name="user_id"/>
                    </div>
                </field>
                <field name="partner_id" position="replace">
                    <label for="partner_id" attrs="{'invisible': [('use_scrum', '=', True)]}"/>
                    <label for="partner_id" string="Product Owner" attrs="{'invisible': [('use_scrum', '=', False)]}"/>
                    <div>
                        <field name="partner_id"/>
                    </div>                    
                </field>

You can see how it works, using this code:
https://vid.me/OG26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions