Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3165 Visualizzazioni

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
Abbandona
Risposta migliore

The create function is same for non-inherited

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
giu 23
2135
1
giu 20
35181
1
giu 16
4593
2
ago 15
5352
1
ago 23
2944