コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
3934 ビュー

```

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
1948
0
7月 24
2974
0
7月 22
60
1
7月 22
2854
2
12月 23
33427