[FIX] account: open form view when single invoice generated
Before this commit, there was no difference whether multiple invoices were uploaded or not. The list view was always opened. Now, the form view is automatically opened when a single bill is uploaded. Task-ID: 2152183
This commit is contained in:
@@ -659,14 +659,20 @@ class AccountJournal(models.Model):
|
||||
'name': _('Generated Documents'),
|
||||
'domain': [('id', 'in', invoices.ids)],
|
||||
'res_model': 'account.move',
|
||||
'views': [[False, "tree"], [False, "form"]],
|
||||
'type': 'ir.actions.act_window',
|
||||
'context': self._context
|
||||
}
|
||||
if len(invoices) == 1:
|
||||
action_vals.update({'res_id': invoices[0].id, 'view_mode': 'form'})
|
||||
action_vals.update({
|
||||
'views': [[False, "form"]],
|
||||
'view_mode': 'form',
|
||||
'res_id': invoices[0].id,
|
||||
})
|
||||
else:
|
||||
action_vals['view_mode'] = 'tree,form'
|
||||
action_vals.update({
|
||||
'views': [[False, "tree"], [False, "form"]],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action_vals
|
||||
|
||||
def _create_invoice_from_single_attachment(self, attachment):
|
||||
|
||||
Reference in New Issue
Block a user