Hi guys,
I've inherited the write function of the model project.issue in V9 so I could send out an e-mail when the issue is changed to the final stage. The strange thing however is that this code goes of twice, but I don't see why.
The code:
The terminal output:@api.multi def write(self, vals): res = super(project_issue, self).write(vals) self.ensure_one() _logger.critical('stage name: ' + str(self.stage_id.name)) if self.stage_id.name == self.project_id.final_fase_id.name: """ This means the issue has entered its final stage and is done. We should now notify the user by e-mail of completion.""" email_template = self.env['mail.template'].search([('name', '=', 'Issue solved')]) email_template.send_mail(self.id, force_send=True, raise_exception=True) return res
So why does this write function goes of twice?2016-02-18 08:46:33,185 15538 INFO MyDb werkzeug: 127.0.0.1 - - [18/Feb/2016 08:46:33] "POST /web/dataset/call_kw/project.task.type/name_get HTTP/1.1" 200 -
2016-02-18 08:46:34,847 15538 CRITICAL MyDb openerp.addons.MyModule.models.project_issue: stage name: Done
2016-02-18 08:46:36,050 15538 INFO MyDb openerp.addons.mail.models.mail_mail: Mail with ID 19 and Message-Id u'<1455785194.900032924652100.686587842139294-openerp-20-project.issue@odoo8>' successfully sent
2016-02-18 08:46:36,057 15538 INFO MyDb openerp.models.unlink: User #1 deleted mail.mail records with IDs: [19]
2016-02-18 08:46:36,070 15538 INFO MyDb openerp.models.unlink: User #1 deleted mail.message records with IDs: [142]
2016-02-18 08:46:36,077 15538 CRITICAL MyDb openerp.addons.MyAddon.models.project_issue: stage name: Done
2016-02-18 08:46:37,264 15538 INFO MyDb openerp.addons.mail.models.mail_mail: Mail with ID 20 and Message-Id u'<1455785196.118980884552002.189632093322604-openerp-20-project.issue@odoo8>' successfully sent
Yenthe