Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Available variables:
- # - time, datetime, dateutil, timezone: Python libraries
- # - env: Odoo Environement
- # - model: Model of the record on which the action is triggered
- # - record: Record on which the action is triggered if there is one, otherwise None
- # - records: Records on which the action is triggered if there is one, otherwise None
- # - log : log(message), function to log debug information in logging table
- # - Warning: Warning Exception to use with raise
- # To return an action, assign: action = {...}
- action_lines = env['project.task.action.line'].search([('dossie_id','=',record.id),('state','=','i')])
- action_lines.write({'state':'c'})
- stage = env['project.task.type'].search([('name','=','Cancelado')], limit=1)
- for action_line in action_lines:
- action_line.task_id.write({'stage_id':stage.id})
- #and add a new action line with name Validar cancelamento in all active tasks
- tasks = env['project.task'].search([('stage_id.closed','=',False),('dossie_id','=',record.id)])
- action_id = 24 # PLEASE MANUALLY PICK THE ACTION ID FROM MODEL
- if tasks:
- for task in tasks:
- env['project.task.action.line'].create({'task_id':task.id, 'action_id':action_id})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement