Odoo Help

Welcome!

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.

0

Getting res_id from context in a form view

By
Olivier
on 2/24/16, 11:01 AM 690 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

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

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

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)

Stats

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