Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3164 Weergaven

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
Annuleer
Beste antwoord

The create function is same for non-inherited

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jun. 23
2134
1
jun. 20
35180
1
jun. 16
4592
2
aug. 15
5351
1
aug. 23
2943