diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 8db08f9ff60..fd6829ec88f 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -430,7 +430,7 @@ class account_journal(models.Model): rslt_sum += target_currency.round(amount) return (rslt_count, rslt_sum) - def action_create_new(self): + def _get_move_action_context(self): ctx = self._context.copy() ctx['default_journal_id'] = self.id if self.type == 'sale': @@ -440,13 +440,16 @@ class account_journal(models.Model): else: ctx['default_move_type'] = 'entry' ctx['view_no_maturity'] = True + return ctx + + def action_create_new(self): return { 'name': _('Create invoice/bill'), 'type': 'ir.actions.act_window', 'view_mode': 'form', 'res_model': 'account.move', 'view_id': self.env.ref('account.view_move_form').id, - 'context': ctx, + 'context': self._get_move_action_context(), } def create_cash_statement(self): @@ -587,6 +590,7 @@ class account_journal(models.Model): for journal_id, prefix in has_sequence_holes ), 'context': { + **self._get_move_action_context(), 'search_default_group_by_sequence_prefix': 1, 'expand': 1, }