Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Hide column tree view

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
15 Risposte
52444 Visualizzazioni
Avatar
karlos

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
Avatar
Abbandona
Avatar
Jose David Moreno Hernandez
Risposta migliore

You can use 'column_invisible' (Odoo 12 at least) attribute like this! :)

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

This works when your tree view is inside another view, for example a form. With 'parent' magic word you can access one of the fields in the parent.

As some other people pointed in this thread, hiding column fields for conditions based on tree lines is not possible, but here we use the parent, so no problem.

8
Avatar
Abbandona
Sam fayad

worked for me , thanks
but can I understand what parent represents? ( I know it's the parent view that tree is embeded in) but how odoo understand it ?

Avatar
Andreas Brueckl
Risposta migliore

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.

2
Avatar
Abbandona
karlos
Autore

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?

Tintumon

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.

Shiva

invisible= "Flag = True" this in not working for me. I am using open erp version 7,

Flag is my model variable , if selected date is before june 2017 flag value is false and seleted date is greater than jsune 2017 flag value is the false (GST,Service tax). Please help me

Avatar
kaynis
Risposta migliore

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.

1
Avatar
Abbandona
karlos
Autore

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

kaynis

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.

Avatar
Tintumon
Risposta migliore

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.

1
Avatar
Abbandona
Avatar
Lady Sharmane Udtuhan
Risposta migliore

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

0
Avatar
Abbandona
karlos
Autore

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

Avatar
Alloice Lagat
Risposta migliore

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
Avatar
Abbandona
Avatar
Jagdish Panchal
Risposta migliore

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)]}"/>

0
Avatar
Abbandona
karlos
Autore

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

Avatar
Richard
Risposta migliore

You can remove a column from a tree view, based on context or other conditions, by overriding fields view get:


    def fields_view_get(self, view_id=None, view_type='tree', toolbar=False, submenu=False):
result = super(ThisModel, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
if not self.env.context.get('show_the_column', False) and view_type == 'tree':
doc = etree.fromstring(result['arch'])
for field in doc.xpath('//field[@name="name_of_conditional_column"]'):
field.set('invisible', '1')
modifiers = json.loads(field.get('modifiers', '{}'))
modifiers['tree_invisible'] = True
modifiers['column_invisible'] = True
field.set('modifiers', json.dumps(modifiers))
result['arch'] = etree.tostring(doc)
return result
0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now