Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1942 Представления

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.



Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
мар. 21
7
2
нояб. 23
1903
1
дек. 22
3515
1
мар. 22
3107
1
февр. 22
5900