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?