Skip to Content
Menu
This question has been flagged

Hi,

In a new module create by Studio, I have 2 models Tenders & Fundings.

In model Tenders, I defined a Many2many field related to Fundings and in model Fundings, I defined a Many2many field related to Tenders.

I have create a Fundings record with its name and an empty Many2many field and in 2 Tenders records, I have assigned to the Many2many field this Fundings record.

I have then create a Scheduled Action with Studio on Fundings model with the python code:

records = env['x_fundings']
for record in records:
records_batches = env['x_tenders'].search([('x_studio_tenders_type', '=', 'Batch'), ('x_studio_tenders_batch_fundings.x_name', '=', record.x_name)])
record.write({'x_studio_fundings_batches': [(6, 0, records_batches)]})

Unfortunately, if I run manually this action, it does not do anything (the Many2many field is not filled) nor throw any error.

Is there a problem with the logic and/or the syntax used ?

Thanks.



Avatar
Discard
Related Posts Replies Views Activity
0
Mar 21
7
2
Nov 23
739
1
Dec 22
2469
1
Mar 22
1641
1
Feb 22
4185