Odoo Help


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.


filter loaded data via python code

on 11/18/14, 12:21 PM 663 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?

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

1 follower(s)


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