Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3347 Lượt xem

Hello dears,


I am fairly new to automatic actions or scheduled actions.

I want to move automatically tasks in stage "Refused" to stage "Completed" .. just as an example

I have tried creating a ir.cron job, and also tried to write the simple code into automated actions but none of its working


my plain code in automatic action, model is selected as task

for rec in model.search([]):
if rec.stage_id.id == '66' and rec.task_ids:
for task in rec.task_ids:
task['stage_id.id'] = '67'


I keep getting errors like the opperand is not supported etc .. same when trying to run my cron job.


I have tried defining the cron job like this 

@api.model    

def _cron_change_task_stage(self):        

for rec in self.env['project.task'].search([]):            

if rec.stage_id == 'Refused' and rec.task_ids:                

for task in rec.task_ids:                    

task['stage_id'] = 'Completed'


Any ideas please ? 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

What you can do is create an automated action like this:


What this does: when the field "Stage" is edited to stage 66, it will override the field with 67. So the tasks Refused will move to Completed.

You can do this via Settings > Technical > Automation > Automated Actions. You must be in developer mode and must have the module "base_automation" installed. 

Hope this helps!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 23
2098
2
thg 12 23
5679
1
thg 11 22
2567
1
thg 11 22
2344
1
thg 8 22
2631