Skip to Content
Menu
This question has been flagged
1 Atsakyti
2764 Rodiniai

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!

Portretas
Atmesti
Best Answer

The create function is same for non-inherited

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
birž. 23
1608
1
birž. 20
34581
1
birž. 16
4173
2
rugp. 15
4986
1
rugp. 23
2503