Odoo Help

2

0
7 Answers
1
Manuel Llano
01/05/15 14.08

Look this:

http://vitraining.com/show-hide-columns-in-openerp-tree-view-xml

Works fine for me.

1
Abhishek
22/07/13 10.01

Hi Yogesh,

I am giving you a similar py code , here i used this to hide two field with a condition in account_invoice.py To hide few column in tree view of account invoice, may be it help to you .....

    if view_type == 'tree':
        partner_string = _('Customer')
        if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'):
            partner_string = _('Supplier')
            for node in doc.xpath("//field[@name='reference']"):
                node.set('invisible', '0')
        for node in doc.xpath("//field[@name='partner_id']"):
            node.set('string', partner_string)
            if partner_string =='Customer' :
                                    print "abhishek"
                                    for node in doc.xpath("//field[@name='s_invoice']"):
                                            node.set('invisible', 'True')
                                            doc.remove(node)
                                    for node in doc.xpath("//field[@name='origin']"):
                                            node.set('invisible', 'True')
                                            doc.remove(node)
                                            print "abhishek"#, stop 
        res['arch'] = etree.tostring(doc)
    return res

If this help then let me ..

3 Comments
Yogesh
29/07/13 03.49

@Abhishek: thanks for your reply but In my case fields_view_get never gets called because it is a child's object (o2m) tree view with editable="bottom"

Jagdish Panchal
04/12/13 05.58

Facing Same problem

dirtyHandsPHP
15/10/14 08.18

@Abhishek: In case of Employees list when this function fields_view_get is called?

0
DuongLong
26/03/19 05.44

this module may help: https://apps.odoo.com/apps/modules/10.0/web_onchange_hide_columns/

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now