Odoo Help


how to pass context from XML to JavaScript?

Nathan Thornton
on 3/11/14, 3:07 PM 3,033 views

I have been trying (for days) to pass the context from my XML view to my own JavaScript function as I need the active_id.

The JavaScript function gets data from an external source and populates the table with it, but I need to get the current active_id... Please help!!! This has been driving me insane, all I need is the active_id and nothing else. If there is a way to get this from a pre-existent variable within JavaScript, please let me know what it is.

If I need to use Python, I can, but I do not know how to actually populate my table (it can't be a field) from Python as the documentation does not actually say where returned values go...

Here's an example of my code:

<record id="my_module.example_form" model="ir.ui.view">
        <field name="name">my_module.example_form</field>
        <field name="model">res.partner</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Example Form" version="7.0">
             <script type="text/javascript">
                 $('#My_Table').ready(function() {
                <table id="My_Table">

Hi did you succeed? I need help along the same lines

Billiard R Made
on 12/6/14, 1:42 PM

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

4 follower(s)


Asked: 3/11/14, 3:07 PM
Seen: 3033 times
Last updated: 4/21/15, 6:14 AM