跳至内容
菜单
此问题已终结
3 回复
3872 查看

```

duplicate_beneficiaries_ids = fields.Many2many(
        "openg2p.beneficiary",
        string='Potential Duplicates'
    )
@ api.onchange('stage_id')
    def checking_duplicates(self):
        if int(self.stage_id.id) == 2:
            my_list = self.search_beneficiary()
            if my_list:
                my_list = json.loads(my_list)
                benf_ids = [li['beneficiary'for li in my_list]
                for ids in benf_ids:
                    self.write({'duplicate_beneficiaries_ids': [(4, ids)]})

```
It gives syntax error at 'self.write',according to documentation it is correct.
The error:psycopg2.errors.SyntaxError: syntax error at or near ")" 

形象
丢弃
最佳答案

Hi,

    Try this,

    self.write({'duplicate_beneficiaries_ids'my_list and [(6, 0, my_list)] or False}) 

Hope it helps,

Thanks


形象
丢弃
编写者 最佳答案

@Karthikeyan N R

still showing the same error:

psycopg2.errors.SyntaxError: syntax error at or near ")"
LINE 3: ...ng2p_registration_rel.openg2p_registration_id IN () AND open...


形象
丢弃
最佳答案

Hi,

try with the below solution.

self.write({'duplicate_beneficiaries_ids': [(4, ids, False)]})

Thanks & Regards,

Sunny Sheth






形象
丢弃
相关帖文 回复 查看 活动
1
2月 24
1885
0
7月 24
2876
0
7月 22
60
1
7月 22
2779
2
12月 23
33330