Odoo Help


Getting current product record id in javascript file.

Akhil P Sivan
on 3/19/15, 4:17 AM 3,633 views

I am having a button in product form. And on click, perform an action based on javascript. But to do that action I need to get the current product id in the js file. How can I get the id in js file?




| 5 3 8
Pondicherry, India
On 3/20/15, 3:15 AM

Hi Akhill:

In your .py method just call self._id to get the current id.

In js just call this.id to get the current id

Am not getting right after giving "this.id" in js file. In js file what does "this" represents? After looking in some usages in odoo js files, its the current page or widget you are working na?

Akhil P Sivan
on 3/24/15, 8:41 AM

in js, this.id represents the current recodr id

on 3/24/15, 8:47 AM

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

1 follower(s)


Asked: 3/19/15, 4:17 AM
Seen: 3633 times
Last updated: 6/20/15, 5:59 AM