Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:34:59+00:00 2026-06-16T00:34:59+00:00

Considering the following objects and a corresponding view: class first_object(osv.osv): _name = first.object _columns

  • 0

Considering the following objects and a corresponding view:

class first_object(osv.osv):
    _name = "first.object"
    _columns = {
                'id': fields.integer ('First ID'),
                'flag': fields.boolean ('Flag'),
                'second_object_id': fields.one2many('second.object','first_object_id')
    }

class second_object(osv.osv):
    _name = "second.object"
    _columns = {
                'id': fields.integer ('Second ID'),
                'first_object_id': fields.many2one('first.object','random field'),
                'field_x': fields.float('x',size=128),
                'field_y': fields.float('y',size=128),
    }

<record model="ir.ui.view" id="first_object_view_id">
    <field name="name">Frist Object</field>
    <field name="model">first.object</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
        <form>
            <notebook>
                <page>
                    <field name="id"></field>
                    <field name="flag"></field>
                    <field name="second_object_id">
                        <tree editable="top">
                            <field name="field_x" attrs="{'invisible':[('flag','=',True)]}"/>
                            <field name="field_y"/>
                        </tree>
                        <form>
                            <field name="field_x"/>
                            <field name="field_y"/>
                        </form>
                    </field>
                </page>
            </notebook>
        </form>
    </field>
</record>

Notice the attrs I have now for the field of the second object named field_x in the tree which is based on the field of the first object named flag.

First of all, the attribute in this case is ignored completely. I dont know why it wont work. Second, assuming this can’t work and the attributes MUST refer to local fields, the invisible attribute does not work for the tree view, just the form view. However, if you set a simple invisible=”1″ in the tree it would work just fine (I cant rely on that, I need the rule I provide with attributes). Any ideas?

EDIT:
The problem seems to be making fields invisible via attributes (and not invisible=”1″) in the TREE view. It works fine in the form. If this can be done it would solve my problem.

EDIT 2:
I tried with separated view definitions and local fields instead of many2one and one2many to no avail. However, I managed to somehow achieve this with invisible="context.get('xxx',True/False)". The problem is once the condition is matched, it remains invisible even after creating a new record where the condition is not matched.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:35:00+00:00Added an answer on June 16, 2026 at 12:35 am

    it seems trying to set an conditional invisible attribute will not affect the true view. only invisible=”1″. which makes sense since i can’t imagine a tree view with some invisible field of which the entire column itself is not invisible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering the following piece of code. #include <iostream> using namespace std; class Object {
Considering following code public class A { public static void main(String[] args) { new
Considering the following table: someId INTEGER #PK ageStart TINYINT(3) ageEnd TINYINT(3) dateBegin INTEGER dateEnd
Considering this part of a Java class, private List<Object> components = new ArrayList<Object>(); private
Considering following code: class Results { public int playerId; public int score; public int
Considering the following code snippet: Object bar1 = new ... ; Object bar2 =
Considering the following case in C#: class Foo { public Foo() { } }
Considering the following architecture: a base object 'Entity' a derived object 'Entry:Base' and a
Considering the following sample XAML file, which shows the first 1000 people of Facebook,
Considering the following TSQL: INSERT INTO Address(Street1, City, State, ZipCode) SELECT Street1, City, StateCode,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.