Skip to Content
Menu
This question has been flagged
2 Replies
9257 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
Avatar
Discard
Best Answer
Avatar
Discard
Best Answer

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

Avatar
Discard

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

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

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?

@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