Can we call a function to return to form after the button wizard is called?
My code:
class HrPlanWizard(models.TransientModel):
_inherit = 'hr.plan.wizard'
def action_launch(self): //Button in wizard
self.action_launchplan()
self.open_plans()
def open_plans(self): //this is a button for return form
self.ensure_one()
return {
'name': 'Plans',
'type': 'ir.actions.act_window',
'view_mode': 'tree',
'target': 'current',
# 'res_id': self.id,
# 'next': {"type":"ir.actions.act_window_close"},
'res_model': 'hr.plan.activity',
'next': {'type': 'ir.actions.act_window_close'},
'context': {'create': False, 'delete': False, 'edit': False,},
'domain': [('id','in', self.employee_id.plan_line_ids.ids)],
}
def action_launchplan(self): // this is the record i want to return tree or form
for i in self.plan_id.plan_activity_type_ids:
self.env['hr.plan.activity'].create({
'employee_id': self.employee_id.id,
'plan_activity_type_id': i.id,
'date':date.today(),
'plan_id':self.plan_id.id,
'line_ids': [(0,0, {
'name': i.name,
'description': i.description,
})for i in i.line_ids]
})