[FIX] purchase: remove useless and broken override
There was several issues with this method: - the workflow is incorrectly called (`purchase.signal_workflow(...)` instead) - the workflow no longer exists (`purchase.state = 'sent'` instead) - the code is only triggered when sending an actual mail and not a notification - the code is never executed as the change is already changed The last point is due to the override of `send_mail` in mail.compose.message. The state is changed before `_postprocess_sent_message` is called (if called at all). Similar change of state is already done for sale.order. This commit replaces and closes #14760
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import account_invoice
|
||||
import mail_mail
|
||||
import purchase
|
||||
import res_company
|
||||
import res_config
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class MailMail(models.Model):
|
||||
_name = 'mail.mail'
|
||||
_inherit = 'mail.mail'
|
||||
|
||||
@api.multi
|
||||
def _postprocess_sent_message(self, mail_sent=True):
|
||||
for mail in self:
|
||||
if mail_sent and mail.model == 'purchase.order':
|
||||
purchase_order = self.env['purchase.order'].browse(mail.res_id)
|
||||
if purchase_order.state == 'draft':
|
||||
self.env['purchase.order'].signal_workflow([mail.res_id], 'send_rfq')
|
||||
return super(MailMail, self)._postprocess_sent_message(mail_sent=mail_sent)
|
||||
Reference in New Issue
Block a user