From c2bd44203421137a8e2e550d73ff28dcf2431aa7 Mon Sep 17 00:00:00 2001 From: Katherine Zaoral Date: Tue, 11 Aug 2020 18:27:59 +0000 Subject: [PATCH] [IMP] l10n_latam_invoice_document: add account_debit_note as dependency In version 13.0 we add account_debit_note as dependency to l10n_ar_edi, but this was made because we were not able to add new depends to l10n_latam_invoice_document module in stable version. Now that we are in master we are able to add the dependency directly here and remove it from l10n_ar_edi closes odoo/odoo#55771 Related: odoo/enterprise#12361 Signed-off-by: Josse Colpaert --- .../l10n_latam_invoice_document/__manifest__.py | 1 + .../wizards/__init__.py | 1 + .../wizards/account_debit_note.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 addons/l10n_latam_invoice_document/wizards/account_debit_note.py 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