[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 <adwid@users.noreply.github.com>
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit is contained in:
Adrien Widart
2021-06-08 16:52:08 +00:00
parent 24fc95090a
commit 07aa40d5b5
+3 -1
View File
@@ -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':