Inside a model which I have created, I implemented the write method to update another model fields , so I want to invoke this operation on every record creation but apparently Odoo invokes the method only when updating the record.
Here it is an excerpt from the model:
class formulaire_evaluation(models.Model):
_name = 'pncevaluation.fe'
_description = u"Formulaire d\'évaluation"
name = fields.Char(u"Intitulé du formulaire")
contributeur = fields.Many2one('pncevaluation.contributeur',string="Contributeur")
date = fields.Date(u"Date")
@api.multi
def write(self, vals):
rec = super(formulaire_evaluation, self).write(vals)
#my_custom_code
return rec