Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3161 Vizualizări

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!

Imagine profil
Abandonează
Cel mai bun răspuns

The create function is same for non-inherited

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
iun. 23
2129
1
iun. 20
35175
1
iun. 16
4587
2
aug. 15
5349
1
aug. 23
2943