[FIX]account,account_debit_note: not show only purchaseable product

Only purchaseable products are not searchable in the lines of debit notes
and credit notes if this account moves are created from their tree view with
the CREATE button. This changes make that this behavieour were also if we
create this account moves from the buttons in the invoices "ADD CREDIT NOTE"
and "ADD DEBIT NOTE".

closes odoo/odoo#78266

Task: https://www.odoo.com/my/task/2543493
X-original-commit: 461801335b1bce1390f0e482648eb5eac7c7e3a8
Signed-off-by: Florian Gilbert <flg@odoo.com>
This commit is contained in:
Pablo Paez
2021-11-10 06:49:58 +00:00
committed by Florian(flg)
parent 7c43290ff4
commit fc188f8aa2
2 changed files with 5 additions and 1 deletions
@@ -152,10 +152,13 @@ class AccountMoveReversal(models.TransientModel):
action.update({
'view_mode': 'form',
'res_id': moves_to_redirect.id,
'context': {'default_move_type': moves_to_redirect.move_type},
})
else:
action.update({
'view_mode': 'tree,form',
'domain': [('id', 'in', moves_to_redirect.ids)],
})
if len(set(moves_to_redirect.mapped('move_type'))) == 1:
action['context'] = {'default_move_type': moves_to_redirect.mapped('move_type').pop()}
return action
@@ -76,7 +76,8 @@ class AccountDebitNote(models.TransientModel):
'name': _('Debit Notes'),
'type': 'ir.actions.act_window',
'res_model': 'account.move',
}
'context': {'default_move_type': default_values['move_type']},
}
if len(new_moves) == 1:
action.update({
'view_mode': 'form',