Odoo Help


filter loaded data via python code

Muszik Adrián
on 11/18/14, 12:21 PM 1,057 views

In Odoo/Openerp i created a kanban view to display some data. Now i managed to change this view with the `fields_view_get` based on context data. 

    def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
        if context is None:
            context = {}
        res = super(esfyt_subscription_template,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
        if context.get('partner_id', False):
            partner_id = context.get('partner_id', False)
            doc = etree.XML(res['arch'])
            if view_type == 'kanban':
                for node in doc.xpath("//div[@class='oe_module_vignette']"):
                    new_addition = etree.SubElement(node, 'button', {'string' : 'Subscribe', 'type' : 'object', 'name' : 'action_subscribe'})
                    new_addition.text = 'Subscribe'
            res['arch'] = etree.tostring(doc)
        return res

But i need to do the same with the data.  i need to limit some data based on context, o certain models(or rows) arent loaded in the view.

How can i do that?

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.


Odoo Training Center

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

Test it now

Question tools

1 follower(s)


Asked: 11/18/14, 12:21 PM
Seen: 1057 times
Last updated: 3/16/15, 8:10 AM