From fc188f8aa2820927db40af1b90b98e8fce1dc1b3 Mon Sep 17 00:00:00 2001 From: Pablo Paez Date: Fri, 20 Aug 2021 14:54:21 +0000 Subject: [PATCH] [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 --- addons/account/wizard/account_move_reversal.py | 3 +++ addons/account_debit_note/wizard/account_debit_note.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py index c7e13569c08..aef554cc630 100644 --- a/addons/account/wizard/account_move_reversal.py +++ b/addons/account/wizard/account_move_reversal.py @@ -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 diff --git a/addons/account_debit_note/wizard/account_debit_note.py b/addons/account_debit_note/wizard/account_debit_note.py index f3f9a42e5dc..69f03390be5 100644 --- a/addons/account_debit_note/wizard/account_debit_note.py +++ b/addons/account_debit_note/wizard/account_debit_note.py @@ -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',