Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

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.



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 21
7
2
thg 11 23
1907
1
thg 12 22
3517
1
thg 3 22
3107
1
thg 2 22
5905