From 4bbb2e063555c4b7a09252a203bfbaf3457ba55e Mon Sep 17 00:00:00 2001 From: EliseDup Date: Thu, 13 Oct 2016 08:34:00 +0200 Subject: [PATCH] Fix task 025, command@bees follower of purchase order --- beesdoo_purchase/models/purchase.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/beesdoo_purchase/models/purchase.py b/beesdoo_purchase/models/purchase.py index 5060dae..bf08392 100644 --- a/beesdoo_purchase/models/purchase.py +++ b/beesdoo_purchase/models/purchase.py @@ -8,7 +8,10 @@ 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) - # We do not need to update sale_order.mail_followers_ids, the link is automatic ?! + types = self.env['mail.message.subtype'].search([('res_model','=','purchase.order')]) + if command_contact: - self.env['mail.followers'].create({'res_model' : 'purchase.order', 'res_id' : purchase_order.id, 'partner_id' : command_contact.id}) + 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}) + return purchase_order \ No newline at end of file