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.


ODOO9: How to create a smart button in odoo

Drees Far
on 8/2/16, 11:44 AM 168 views

Hello everybody;

I have added a smart button in the payslip view that give access to employee view.

But, the problem is when i click on the button i have the access to all the employees.

Here is the code. Can anyone help please.

                <xpath expr="//field[@name='payslip_count']" position="after">

<div class="oe_button_box" name="button_box">

<button class="oe_inline oe_stat_button" type="action" name="%(action_employee_filtre)d"

attrs="{'invisible': [('employee_id', '=', False)]}" help="Afficher la Fiche Employé" icon="fa-user">

<field string="Fiche Employé" name="employee_count" widget="statinfo"/>




        <record model="ir.actions.act_window" id="action_employee_filtre">

<field name="name">Fiche Employé</field>

<field name="res_model">hr.employee</field>

<field name="view_type">form</field>

<field name="view_mode">tree,form</field>

<field name="domain">[('id', '=', active_id)]</field>


Best Regards.

Your domain doesn't work (I mean this: <field name="domain">[('id', '=', active_id)]</field>). That's the problem. You can pass the active_id which is employee ID (I bet) via python (you have to make action in python code and make button as object type) or context (I'm not sure for context).

Kera Sakti
on 8/3/16, 3:11 AM

hey thanks for your answer but even if i change the id to employee_id i cant get anything as if the employee_id = False. I couldnt understand where is the problem

Drees Far
on 8/3/16, 4:53 AM
On 8/2/16, 12:18 PM

you can click on the link of `many2one` field (Employee field) to see the employee information no ?

if not can you make sure your question is clear?

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: 8/2/16, 11:44 AM
Seen: 168 times
Last updated: 8/2/16, 12:18 PM