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

Hi, everyone!

I need do something after create a recordset.

if the model is inherited some others, I can implement this by the code below:

class Diary(models.Model):
_inherit = 'diary_zqinn.diary'

description = fields.Text()
description_date = fields.Date()

@api.model
def
create(self, vals):
diary = super(Diary, self).create(vals)
'''To do after create.'''
However, if the model is non-inherited one, it will catch the Exception:

AttributeError: 'NoneType' object has no attribute 'id'
So, how to modify the code?

Thanks!

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

The create function is same for non-inherited

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 6 23
2154
1
thg 6 20
35188
1
thg 6 16
4604
2
thg 8 15
5359
1
thg 8 23
2951