diff --git a/modules/account/move.py b/modules/account/move.py index ca8cf76637..a0e36eda7c 100644 --- a/modules/account/move.py +++ b/modules/account/move.py @@ -2207,8 +2207,9 @@ class Reconcile(Wizard): 'account.reconcile.start', 'account.reconcile_start_view_form', [ Button("Cancel", 'end', 'tryton-cancel'), - Button("Reconcile", 'next_', 'tryton-ok', default=True), + Button("Reconcile", 'setup', 'tryton-ok', default=True), ]) + setup = StateTransition() next_ = StateTransition() show = StateView('account.reconcile.show', 'account.reconcile_show_view_form', [ @@ -2324,8 +2325,11 @@ class Reconcile(Wizard): having=having)) return [p for p, in cursor] + def transition_setup(self): + return self.transition_next_(first=True) + @check_access - def transition_next_(self): + def transition_next_(self, first=False): pool = Pool() Line = pool.get('account.move.line') @@ -2359,20 +2363,18 @@ class Reconcile(Wizard): self.show.currencies = currencies return currency - if getattr(self.show, 'accounts', None) is None: + if first: self.show.accounts = self.get_accounts() account = next_account() if not account or (not next_party() and account.party_required): return 'end' - if self.show.account.party_required: - if getattr(self.show, 'parties', None) is None: + if self.show.account.party_required: self.show.parties = self.get_parties(self.show.account) if not next_party(): return 'end' - else: - self.show.parties = [] - self.show.party = None - if getattr(self.show, 'currencies', None) is None: + else: + self.show.parties = [] + self.show.party = None self.show.currencies = self.get_currencies( self.show.account, self.show.party) diff --git a/modules/account/tests/scenario_account_reconcile.rst b/modules/account/tests/scenario_account_reconcile.rst index 38b6544fee..76f4ebd915 100644 --- a/modules/account/tests/scenario_account_reconcile.rst +++ b/modules/account/tests/scenario_account_reconcile.rst @@ -102,14 +102,14 @@ Run Reconcile for only balanced:: >>> reconcile = Wizard('account.reconcile') >>> reconcile.form.only_balanced = True - >>> reconcile.execute('next_') + >>> reconcile.execute('setup') >>> reconcile.state 'end' Run Reconcile wizard:: >>> reconcile = Wizard('account.reconcile') - >>> reconcile.execute('next_') + >>> reconcile.execute('setup') >>> assertEqual(reconcile.form.party, (customer if party_required else None)) >>> reconcile.form.write_off_amount Decimal('0.00') diff --git a/modules/account/tests/scenario_account_reconcile_automatic.rst b/modules/account/tests/scenario_account_reconcile_automatic.rst index d25730d2c2..ef956ce843 100644 --- a/modules/account/tests/scenario_account_reconcile_automatic.rst +++ b/modules/account/tests/scenario_account_reconcile_automatic.rst @@ -75,7 +75,7 @@ Run Reconcile wizard:: >>> reconcile = Wizard('account.reconcile') >>> reconcile.form.automatic = True - >>> reconcile.execute('next_') + >>> reconcile.execute('setup') >>> lines = Line.find([('account', '=', accounts['receivable'].id)]) >>> len(lines)