diff --git a/addons/l10n_latam_invoice_document/__manifest__.py b/addons/l10n_latam_invoice_document/__manifest__.py index 82bbe9f818d..8f5554e3e7d 100644 --- a/addons/l10n_latam_invoice_document/__manifest__.py +++ b/addons/l10n_latam_invoice_document/__manifest__.py @@ -26,6 +26,7 @@ If your localization needs this logic will then need to add this module as depen """, "depends": [ "account", + "account_debit_note", ], "data": [ 'views/account_journal_view.xml', diff --git a/addons/l10n_latam_invoice_document/wizards/__init__.py b/addons/l10n_latam_invoice_document/wizards/__init__.py index 7076207375e..4d069b503bc 100644 --- a/addons/l10n_latam_invoice_document/wizards/__init__.py +++ b/addons/l10n_latam_invoice_document/wizards/__init__.py @@ -1,3 +1,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import account_move_reversal +from . import account_debit_note diff --git a/addons/l10n_latam_invoice_document/wizards/account_debit_note.py b/addons/l10n_latam_invoice_document/wizards/account_debit_note.py new file mode 100644 index 00000000000..763f3211d90 --- /dev/null +++ b/addons/l10n_latam_invoice_document/wizards/account_debit_note.py @@ -0,0 +1,15 @@ +from odoo import models + + +class AccountDebitNote(models.TransientModel): + + _inherit = 'account.debit.note' + + def create_debit(self): + """ Properly compute the latam document type of type debit note. """ + res = super().create_debit() + new_move_id = res.get('res_id') + if new_move_id: + new_move = self.env['account.move'].browse(new_move_id) + new_move.with_context(internal_type='debit_note')._compute_l10n_latam_document_type() + return res