Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 21
7
2
nov 23
1905
1
dic 22
3515
1
mar 22
3107
1
feb 22
5902