Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2783 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
июн. 23
1619
1
июн. 20
34601
1
июн. 16
4194
2
авг. 15
5012
1
авг. 23
2519