From 07aa40d5b52fa9bb618dea8603de5593c863ae82 Mon Sep 17 00:00:00 2001 From: Adrien Widart Date: Wed, 2 Jun 2021 10:20:24 +0000 Subject: [PATCH] [FIX] purchase: send email on RFQ confirmation When confirming a RfQ, even if a follower is subscribed to "RFQ Confirmed", he will not receive any email. To reproduce the error: (Need a mail catcher) 1. Create a PO 2. Add a follower and edit his subscriptions: - Check 'RFQ Confirmed' 3. Confirm the PO Error: No mail has been sent. The user should have been subscribed to "RFQ Approved" to receive an email. OPW-2447234 closes odoo/odoo#71892 X-original-commit: b459fc86d895dcd0c4bab8bb8332241fe9a43a6f Signed-off-by: Adrien Widart Signed-off-by: William Henrotin --- addons/purchase/models/purchase.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index c36d8e3843a..a60509be3a5 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -252,7 +252,9 @@ class PurchaseOrder(models.Model): def _track_subtype(self, init_values): self.ensure_one() if 'state' in init_values and self.state == 'purchase': - return self.env.ref('purchase.mt_rfq_approved') + if init_values['state'] == 'to approve': + return self.env.ref('purchase.mt_rfq_approved') + return self.env.ref('purchase.mt_rfq_confirmed') elif 'state' in init_values and self.state == 'to approve': return self.env.ref('purchase.mt_rfq_confirmed') elif 'state' in init_values and self.state == 'done':