I have created a "assign" button in Helpdesk Module which on click opens a Maintenance Request form with some data from helpdesk. And the problem is that I've to save the request manually every time. What should I do to save the maintenance request automatically and not affecting the current method on button click.
Here's my python method for button.
@api.multi
def on_assigned(self):
return {
'res_model': 'maintenance.request',
'type': 'ir.actions.act_window',
'context': {
'default_helpdesk_id': self.id,
'default_name': self.name,
},
'domain': [('customer_id', '=', self.customer_id)],
'view_mode': 'form',
'view_type': 'form',
'res_id': self.env['maintenance.request'].search([('helpdesk_id', '=', self.id)]).id,
'view_id': self.env.ref("maintenance.hr_equipment_request_view_form").id,
}
I just want to add the "Save" functionality on this button click. Any luck?