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 field in fields_view_get function

By
Thazin Khaing
on 12/5/13, 6:22 AM 2,381 views
 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        #override of fields_view_get in order to change the label of the process button and the separator accordingly to the shipping type
        if context is None:
            context={}
        res = super(stock_partial_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
        type = context.get('default_type', False)
        if type:
            doc = etree.XML(res['arch'])
            for node in doc.xpath("//button[@name='do_partial']"):
                if type == 'in':
                    node.set('string', _('_Receive'))
                elif type == 'out':
                    node.set('string', _('_Deliver'))

    ................
        i want to hide qty,expire_date field
    ................


        for node in doc.xpath("//separator[@name='product_separator']"):
            if type == 'in':
                node.set('string', _('Receive Products'))
            elif type == 'out':
                node.set('string', _('Deliver Products'))
        res['arch'] = etree.tostring(doc)
    return res
0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 10/9/14, 9:11 AM

set "invisible" attribute in node... exactly like how 'string' is overridden...

@deep: Can i use fields_view_get function to check which user is logged-in and make fields invisible on basis of that?

dirtyHandsPHP
on 10/15/14, 7:30 AM

Sure you can, than user, it will be wise to set the attribute depending on Groups [user groups], in that way, you will not have to worry in future if you add a new user...

deep
on 10/15/14, 8:41 AM

In case of groups, if two employees belongs to the same group and they can see each other's information, I want to show a field when he/she opens his profile but hide when opens other employee's profile...so which approach should i go with?

dirtyHandsPHP
on 10/16/14, 12:34 AM

@deep: I have posted question on forum as well....for more details please check here : https://www.odoo.com/forum/help-1/question/hide-tab-from-other-user-65238

dirtyHandsPHP
on 10/16/14, 12:50 AM
0

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: 12/5/13, 6:22 AM
Seen: 2381 times
Last updated: 3/16/15, 8:10 AM