Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
15502 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 25
263
1
thg 7 25
5036
0
thg 7 25
594
0
thg 6 25
681
1
thg 6 25
857