İçereği Atla
Menü
Bu soru işaretlendi

Hi Community,

I have one dropdown field and dropdown field's selected data add to the Followers List. now my problem is that when i'm trying to remove all records from dropdown list that time dropdown list would be blank but the same records does not remove from the Followers List. so how to remove single record from the dropdown field please let me know.

See my Code.

.py File

@api.multi
def write(self, vals):
    res = super(CrmLead, self).write(vals)
    for rec in self:
        if rec.estimation_id:
            partner_ids = []
            for est_rec in rec.estimation_id:
                if est_rec.partner_id and est_rec.partner_id.email:
                    partner_ids.append(est_rec.partner_id.id)
            rec.message_subscribe(partner_ids, None)
            #message_unsubscribe
            message_partner_ids = rec.message_partner_ids.ids
            est_ids = [est_rec.partner_id.id for est_rec in rec.estimation_id] + [self.env.ref('base.partner_root').id]
            unsub_partners = set(message_partner_ids) - set(est_ids)
            template_obj = self.env['mail.mail']
            template_data = {
                                            'subject': 'New Estimation Asign : ',
                                            'body_html': "message_body",
                                            'email_from': self.env['mail.message']._get_default_from(),
                                            'email_to': est_rec.partner_id.email
                                        }
            template_id = template_obj.create(template_data)
            template_obj.send(template_id)
            if list(unsub_partners):
                rec.message_unsubscribe(list(unsub_partners))
    return res

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
8
Tem 17
10159
1
Ağu 21
9199
1
Eyl 24
7276
2
Eyl 22
10853
0
Eki 19
92