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

Hide column tree view

By
karlos
on 9/13/13, 6:55 AM 4,045 views

First, is it possible? Because, I have a code which works perfectly in Form (to hide or not), but whenever I put the same code on a tree view, it doesn't work.

<field name="arch" type="xml">
            <tree string="the tree">
                <field name="group_name" invisible="1"/>
                <field name="date_register" attrs="{'invisible':[('group_name','==',True)]}"/>
2

Andreas Brueckl

--Andreas Brueckl--
5056
| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 9/13/13, 7:34 AM

Imho in a Tree-View attr functionality does not work since a Tree-View displays several objects. There would be a problem if some of the objects fulfill the attr-domain and some do not.

Its not possible to hide a column only for certain objects.

Yes, I came to the same result searching "deeper" in google. It only hides the values, not the column it-self. Will this be available in next version or something?

karlos
on 9/13/13, 8:10 AM

Instead of attrs="{'invisible':[('group_name','==',True)]}" It hides only data/content of that column. So, I tried to use invisible=context.get('group_name' = True" It hides the complete column from that Tree view.

Tintu Mon
on 4/11/16, 9:42 AM
1
kaynis
On 9/13/13, 9:01 AM

If you want to hide a column in the tree view simply look for that column (this is for practice) in the code and add some thing like group=base.group_system for admin configuration login view or base.group_erp_manager for admin access right or base.group_extended for extended view only or base.group_user for all employees. You can also create your own group and add the id of this group to the field

   e.g <field name="you_required_column_id" group="base.group_user"/>

you can add this in the view code for the tree of your module.

<field name="arch" type="xml">
        <tree string="the tree">

            <field name="date_register" group="base.group_system"/>
<!-- this should hide this field from anyone that does not have admin configuration access-->

if you want to hide a column from a specific group a way you can do that is to create a group and add the group to all the other groups by inheritance except the one you don't wish to give access to then add the id of the created field as above.

Please, see the following link: http://pastebin.com/7ZG58pY9

karlos
on 9/13/13, 12:16 PM

When you tried this were you logged in as an administrator or as a user with not admin right? After adding the group to the xml you will need to upgrage or reinstall the module, restarting the server will not affect changes made in your xml.

kaynis
on 9/17/13, 5:25 AM
0
Tintu Mon
On 4/11/16, 9:49 AM

In Tree view, it doesn't hide a complete column when you use attrs like this

attrs="{'invisible':[('group_name','==',True)]}

Because, I found it only hides the content in that column. So I tried to using

invisible="context.get('group_name') = True"

instead of above one. It hides the complete column in Tree view. I hope it will help you.

0
Alloice Lagat
On 9/17/13, 4:34 AM

In order to have tour changes when you do a modification,, you need to upgrade the module and update it..That way you will see the changes, else you wont have any

0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 9/13/13, 10:33 AM

Hello

I have hide button in tree view using this code and its working fine for me

<button name="%(purchase.act_res_partner_2_supplier_invoices)d" icon="gtk-go-forward" type="action" attrs="{'invisible': ['|',('customer','=',True), ('interger_field','=',0)]}"/>

Please, see the following link: http://pastebin.com/7ZG58pY9

karlos
on 9/13/13, 12:16 PM
0

As far as I know it is possible.. What type of field is your group_name?? It is possible to hide it but if you want to hide it then their is a certain condition that trigger to become visible i think it is not possible.. :D

It's not possible to hide a entire column with certain condition. Hope this is released soon.

karlos
on 9/13/13, 8:10 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: 9/13/13, 6:55 AM
Seen: 4045 times
Last updated: 4/11/16, 9:49 AM