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