Skip to content

Commit

Permalink
Merge 3f068bc into 2bee212
Browse files Browse the repository at this point in the history
  • Loading branch information
jarroyomorales committed Sep 23, 2019
2 parents 2bee212 + 3f068bc commit bdb29fb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions multi_step_wizard/__manifest__.py
Expand Up @@ -4,8 +4,8 @@
'version': '11.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3',
'depends': [],
'website': 'https://github.com/camptocamp/connector-jira',
'depends': ['base'],
'website': 'https://github.com/OCA/connector-jira',
'data': [
'views/multi_step_wizard_views.xml',
],
Expand Down
9 changes: 9 additions & 0 deletions multi_step_wizard/models/multi_step_wizard.py
Expand Up @@ -54,6 +54,15 @@ def open_next(self):
state_method()
return self._reopen_self()

def open_previous(self):
state_method = getattr(self, 'state_previous_%s' % (self.state,), None)
if state_method is None:
raise NotImplementedError(
'No method defined for state %s' % (self.state,)
)
state_method()
return self._reopen_self()

def _reopen_self(self):
return {
'type': 'ir.actions.act_window',
Expand Down
37 changes: 19 additions & 18 deletions multi_step_wizard/views/multi_step_wizard_views.xml
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="multi_step_wizard_form" model="ir.ui.view">
<field name="name">multi.step.wizard.form</field>
<field name="model">multi.step.wizard.mixin</field>
<field name="arch" type="xml">
<form>
<field name="state" invisible="1"/>
<footer>
<div name="states_buttons" attrs="{'invisible': [('state', '=', 'final')]}">
<button name="open_next" string="Next" type="object" class="btn-primary"/>
<button string="Cancel" class="btn btn-default" special="cancel" />
</div>
<div name="final_buttons" attrs="{'invisible': [('state', '!=', 'final')]}">
<button string="Close" class="btn btn-primary" special="cancel" />
</div>
</footer>
</form>
</field>
</record>
<record id="multi_step_wizard_form" model="ir.ui.view">
<field name="name">multi.step.wizard.form</field>
<field name="model">multi.step.wizard.mixin</field>
<field name="arch" type="xml">
<form>
<field name="state" invisible="1"/>
<footer>
<div name="states_buttons">
<button name="open_next" string="Next" type="object"
class="btn-primary" attrs="{'invisible': [('state', '=', 'final')]}"/>
<button name="open_previous" string="Go Back" type="object"
class="btn btn-default" attrs="{'invisible': [('state', '=', 'start')]}"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</div>
</footer>
</form>
</field>
</record>

</odoo>

0 comments on commit bdb29fb

Please sign in to comment.