Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Done by RHT on the 28/08/2024
- # Need : Have recurrent task
- # Task : https://www.odoo.com/odoo/project/5686/tasks/4143143
- # Pastebin : https://pastebin.com/sAZtiGQP
- for task in records:
- # R1 ID --> 394
- # R2 ID --> 405
- # R3 ID --> 406
- # RM1 ID --> 421
- # RM2 ID --> 422
- # RM3 ID --> 614
- # if task has label R1
- if 394 in task.tag_ids.ids:
- label = 405
- task_name = 'Rappel 1'
- number_of_days = 35
- # if task has label R2
- if 405 in task.tag_ids.ids:
- label = 406
- task_name = 'Rappel 2'
- number_of_days = 20
- # if task has label R3
- if 406 in task.tag_ids.ids:
- label = 0
- task_name = 'Rappel 3'
- number_of_days = 12
- # if task has label RM1
- if 421 in task.tag_ids.ids:
- label = 422
- task_name = 'Rappel mensuel 1'
- number_of_days = 12
- # if task has label RM2
- if 422 in task.tag_ids.ids:
- label = 614
- task_name = 'Rappel mensuel 2'
- number_of_days = 9
- # if task has label RM3
- if 614 in task.tag_ids.ids:
- label = 0
- task_name = 'Rappel mensuel 3'
- number_of_days = 8
- new_task = env['project.task'].create(
- {
- 'name' : task_name,
- 'project_id' : task.project_id.id,
- 'date_deadline' : datetime.date.today() + datetime.timedelta(days=number_of_days),
- 'user_ids' : task.user_ids.ids,
- })
- if label != 0:
- new_task.write(
- {
- 'tag_ids' : [(4, label)] ,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement