Skip to content

Commit

Permalink
Go back to the Transfer wizard when the user click on Cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis de Lattre committed Jan 8, 2015
1 parent 3d10a42 commit fada9c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions stock_packaging_usability_ul/wizard/stock_select_ul.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,21 @@ def validate(self):
trf_line_wiz.put_in_pack()
action = trf_line_wiz.transfer_id.wizard_view()
return action

@api.multi
def cancel(self):
"""We have to re-call the wizard when the user clicks on Cancel"""
self.ensure_one()
if self.env.context.get('pack_function') == 'put_residual_in_new_pack':
assert self.env.context.get('active_model') == \
'stock.transfer_details', 'Wrong underlying model'
trf_wiz = self.env['stock.transfer_details'].browse(
self.env.context['active_id'])
action = trf_wiz.wizard_view()
elif self.env.context.get('pack_function') == 'put_in_pack':
assert self.env.context.get('active_model') == \
'stock.transfer_details_items', 'Wrong underlying model'
trf_line_wiz = self.env['stock.transfer_details_items'].browse(
self.env.context['active_id'])
action = trf_line_wiz.transfer_id.wizard_view()
return action
3 changes: 2 additions & 1 deletion stock_packaging_usability_ul/wizard/stock_select_ul.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<footer>
<button name="validate" type="object"
string="Validate" class="oe_highlight"/>
<button special="cancel" string="Cancel" class="oe_link"/>
<button name="cancel" type="object"
string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
Expand Down

0 comments on commit fada9c3

Please sign in to comment.