콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3299 화면

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!

아바타
취소
베스트 답변

The create function is same for non-inherited

아바타
취소
관련 게시물 답글 화면 활동
2
6월 23
2310
1
6월 20
35357
1
6월 16
4811
2
8월 15
5486
1
8월 23
3144