From 943bb5abdbe9c1109a502a01ecb9cdae0d65a63e Mon Sep 17 00:00:00 2001 From: EliseDup Date: Mon, 17 Oct 2016 17:02:47 +0200 Subject: [PATCH] S0025 : fix. Add subtypes discussion and those linked to purchase_order --- beesdoo_purchase/models/purchase.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/beesdoo_purchase/models/purchase.py b/beesdoo_purchase/models/purchase.py index bf08392..9c907f8 100644 --- a/beesdoo_purchase/models/purchase.py +++ b/beesdoo_purchase/models/purchase.py @@ -8,10 +8,11 @@ class PurchaseOrder(models.Model): def create(self, vals): purchase_order = super(PurchaseOrder, self).create(vals) command_contact = self.env.ref('beesdoo_base.commande_beescoop', raise_if_not_found=False) - types = self.env['mail.message.subtype'].search([('res_model','=','purchase.order')]) + types = self.env['mail.message.subtype'].search(['|',('res_model','=','purchase.order'),('name','=','Discussions')]) if command_contact: - self.message_subscribe(partner_ids=command_contact, subtype_ids=types) - # self.env['mail.followers'].create({'res_model' : 'purchase.order', 'res_id' : purchase_order.id, 'partner_id' : command_contact.id}) - + self.env['mail.followers'].create({'res_model' : 'purchase.order', + 'res_id' : purchase_order.id, + 'partner_id' : command_contact.id, + 'subtype_ids': [(6, 0, types.ids)]}) return purchase_order \ No newline at end of file