Search code examples
reportodooodoo-10qweb

How to print employee details like employee phone num, department etc in odoo qweb report


I want to print employee details from hr.employee model to my qweb report(Purchase Requisition).

I am trying the code like following:

                            <tr>
                                <td style="border:1px solid #000;padding-left:5px">Department:<span t-esc="o.user_id.partner_id.department_id.name"/></td>
                                <td style="border:1px solid #000;padding-left:5px"> </td></tr>

And facing this error: Error to render compiling AST AttributeError: 'res.partner' object has no attribute 'department_id'

I understood that my current object does'nt contain department_id field. Then how can I get this employee details from hr.employee model for the logged in user??

Any help is highly appreciated and I am using odoo 10. Thanks!


Solution

  • According to the code of the hr module, you most likely need to use:

    <span t-esc="', '.join(o.user_id.mapped('employee_ids.department_id.display_name'))"/>