Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
3995 Zobrazení

```

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 ")" 

Avatar
Zrušit
Nejlepší odpověď

Hi,

    Try this,

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

Hope it helps,

Thanks


Avatar
Zrušit
Autor Nejlepší odpověď

@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...


Avatar
Zrušit
Nejlepší odpověď

Hi,

try with the below solution.

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

Thanks & Regards,

Sunny Sheth






Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
úno 24
2012
0
čvc 24
3068
0
čvc 22
60
1
čvc 22
2967
2
pro 23
33473