[FIX] account: When filling gaps, create button has bad default journal
When using the "Holes in sequence" shortcut on a journal in the Dashboard, the "Create" form shows the Miscellanous Entries journal as a default instead of the same Journal that the user trying to fix. https://watch.screencastify.com/v/kUorLSIHwoy97UKuDJBC closes odoo/odoo#101926 X-original-commit: a8f9950d6d55137f9c9de15042f6cb717e4a7140 Signed-off-by: Cedric Snauwaert <csn@odoo.com> Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user