Odoo Help

0

Getting res_id from context in a form view

By
Olivier
on 2/24/16, 11:01 AM 1,124 views

Hello,

I'm trying to open a specific employee form view from a hierarchical tree view. I started by using the same method as accounting "Chart of accounts" but without success.

Here is my code using another method found on the forum https://www.odoo.com/fr_FR/forum/aide-1/question/passing-active-id-to-action-window-in-openerp7-46706 :

<record model="ir.actions.act_window" id="action_employee_items">
    <field name="name">Employee Details</field>
    <field name="res_model">hr.employee</field>
    <field name="view_type">form</field>
    <field name="view_id" ref="view_hr_employee_form_inherited"/>
    <field name="view_mode">form</field>
    <field name="context">{'res_id': active_id}</field>
</record>

The form opens empty because he cannot get the active_id.

If i put <field name="res_id">INT</field> it works but without variable...

I think I'm missing something but I don't know what.

Thanks for your help guys

0
Olivier
On 2/25/16, 4:08 AM

Hi Axel,

Thank you for your reply. I don't understand clearly what you meant. I need, on the tree view, to open the form view of the employee. If I create an action on the form view it won't be executed before right ?? How to trigger it?

0
Axel Mendoza
On 2/24/16, 1:32 PM

You cannot use variables in the action definition for xml, you need to change the action for the hierarchical tree view to use the view_hr_employee_form_inherited, could be creating an ir.actions.act_window.view for the form view and linked to the action

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.

Register

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

1 follower(s)

Stats

Asked: 2/24/16, 11:01 AM
Seen: 1124 times
Last updated: 2/25/16, 4:08 AM