Odoo Help


How do I get the user avatar in the kanban view of a custom module?

Erick Dyck
on 10/1/13, 4:29 AM 4,200 views

Hey guys, I'm trying to create a custom module and every thing works fine so far. My only problem is, that I'm not able to show the user avatar in the kanban view. I only get a randow image (maybe my function is wrong?) I trying to get the user avatar from res.partners.

Here the pythonscript:

def _get_user_image(self, cr, uid, ids, field, arg, context=None):
        res = {}
        ctx = {}
        records = self.browse(cr, uid, ids, context=context)
        for record in records:
            res[record.id] = record.user_id.pool.get('res.partner')._get_default_image(cr, uid, False, ctx, colorize=True)
        return res


_columns    = {
        'image'     : fields.function(_get_user_image, type="binary", method=True, string='Image', readonly=True),

The view.xml

<record model="ir.ui.view" id="view_gcon_access_kanban">
    <field name="name">gcon.access.kanban</field>
    <field name="model">gcon.access</field>
    <field name="arch" type="xml">
            <field name="user_id"/>
            <field name="name"/>
            <field name="count_contact"/>
            <field name="count_devices"/>
            <field name="image"/>
                <t t-name="kanban-box">
                    <div class="oe_kanban_vignette oe_semantic_html_override">
                        <a type="open">
                             <img t-att-src="kanban_image('gcon.access', 'image', record.id.value)" class="oe_kanban_image"/>
                        <div class="oe_kanban_details">
                                <a type="open">
                                    <field name="user_id"/> (<field name="name"/>)
                                Contacts: <field name="count_contact"/><br />
                                Devices: <field name="count_devices"/>

What of these codes is wrong? In the xml I tried several tag, but nothing worked or rather displayed the wrong image. We are using the openERP v7. Best regards


Erick Dyck
On 10/1/13, 5:52 AM

I have found a solution. I used following tag to get the user avatar:

<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" class="oe_kanban_image"/>

Best Regards


works also with res.partner

odoo v8

Jérôme Thériault
on 2/21/17, 9:03 AM

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

0 follower(s)


Asked: 10/1/13, 4:29 AM
Seen: 4200 times
Last updated: 3/16/15, 8:10 AM