Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3262 Переглядів

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 Відповіді Переглядів Дія
Create function problem Вирішено
2
черв. 23
2243
1
черв. 20
35300
1
черв. 16
4744
2
серп. 15
5441
1
серп. 23
3038