Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
15499 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

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?

in js, this.id represents the current recodr id

Powiązane posty Odpowiedzi Widoki Czynność
0
lip 25
263
1
lip 25
5036
0
lip 25
593
0
cze 25
680
1
cze 25
857