Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
12352 มุมมอง

I have receiving this odoo error when I try to duplicate a set of record. I have inherited ['mail.thread', 'ir.needaction_mixin'] in the current class. I didn't found any solution online or myself or from odoo. Still stuck here around for 2 days.

Anybody have any idea on this ? Currently I'm using Odoo 10.

Thanks & Regards in advance.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
Try:

class Followers(models.Model): _inherit = 'mail.followers' @api.model def create(self, vals): if 'res_model' in vals and 'res_id' in vals and 'partner_id' in vals: dups = self.env['mail.followers'].search([('res_model', '=',vals.get('res_model')), ('res_id', '=', vals.get('res_id')), ('partner_id', '=', vals.get('partner_id'))]) if len(dups): for p in dups: p.unlink() return super(Followers, self).create(vals)
อวตาร
ละทิ้ง

This worked perfecly in Odoo14 Community

Hello, I have gotten the error described in the question when adding an automated action with python code:

https://ibb.co/Xx9p6kJ

Can I add this to my code in an automated action to try and make it work?

ผู้เขียน คำตอบที่ดีที่สุด

Finally find the solution by myself. By adding the code below it is resolved

@api.model
def create(self, vals):
    res = super(ClassName, self).create(vals)
    subtype_ids = self.env['mail.message.subtype'].search(
        [('res_model', '=', 'class.name')]).ids
    res.message_subscribe(
        partner_ids=[res.name_id.partner_id.id],
        subtype_ids=subtype_ids)
    # other logic
    return res


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

We wrote this module that you should be able to drag & drop into your setup to fix this problem.

https://github.com/euroblaze/followerfix

Hope it's useful, feedback welcome!

Regards, Ashant 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I got the same case as you.

where should I put the code?

อวตาร
ละทิ้ง

create a file.py in your module, then inherite the mail.followers models

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 17
2933
1
ก.ย. 18
239
0
มิ.ย. 18
2527
1
ธ.ค. 17
4824
0
พ.ย. 17
3323