콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
11984 화면

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

관련 게시물 답글 화면 활동
0
10월 17
2801
1
9월 18
238
0
6월 18
2413
1
12월 17
4653
0
11월 17
3134