Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Launch a wizard with Save button

By
Julien Weste
on 3/30/16, 10:05 AM 271 views

Hi all,

I would need to modify the Save button effect so that it:

- saves current record as usual

- launches a wizard

I overrided the write function as follows:

--------------------------------------

@api.multi

def write(self, vals):

print vals

if vals.get('start_time', False) or vals.get('duration', False):

vals['end_time'] = (

vals.get('start_time', False) or self.start_time or 0) +\

(vals.get('duration', False) or self.duration or 0)

super(ShiftTemplate, self).write(vals)

view = self.env['ir.model.data'].get_object_reference(

'coop_shift', 'view_update_shifts_form')

view_id = view and view[1] or False

return {

'type': 'ir.actions.act_window',

'res_model': 'update.shifts.wizard',

'view_mode': 'form',

'view_type': 'form',

'res_id': self.id,

'views': [(view_id, 'form')],

'view_id': [view_id],

'target': 'new',

'nodestroy': True,

}

---------------------------------------------

But this dosn't work: the save button just saves current record and doesn't launch my wizard.

Any idea?

Thanks.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/30/16, 10:05 AM
Seen: 271 times
Last updated: 3/30/16, 10:19 AM