Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
3167 Ansichten

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!

Avatar
Verwerfen
Beste Antwort

The create function is same for non-inherited

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Juni 23
2135
1
Juni 20
35181
1
Juni 16
4593
2
Aug. 15
5352
1
Aug. 23
2944