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

May anyone help me know how can i get the current ID of a record before it is created in database.

I have tried :

  1. to get the active_id it does not exist in the url

  2. self._origin.id

  3. self.id

Need your help my friends please.

Thanks a lot in advance.

Best regards.

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

No, you cannot have the ID of the record if it is not created yet.

I don't know why you need the ID but if you want to access the value of the other fields, you can use onchange method to get the value of the fields and do some operations.

@api.onchange('partner_id')
def onchange_partner(self):
self.partner_id
self.my_field1
self.my_field2
   # You can access the value of the fields in the onchange like this
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 11 23
17520
3
thg 11 24
25162
2
thg 12 22
6959
1
thg 11 22
4113
1
thg 10 22
868