From 7d028396e0ede42e1cbb4fe870f1f36866fc9f83 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 21 Mar 2022 10:45:14 +0000 Subject: [PATCH] [FIX] l10n_cl: unable to issue credit note MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Have a CL company setup Issue an invoice Then generate the credit note via 'Add Credit Note' wizard Add a reason (credit method is locked to 'partial refund') and confirm Error will raise “You can not use a invoice document type with a refund invoice” This occur after https://github.com/odoo/enterprise/commit/9e049b833b23809e4287ef61ddf7482413debefd We now fall back to the logic of l10n_latam_invoice_document which, in turns, fall back to the l10n_cl, ignoring the 'credit_note' case. opw-2794515 closes odoo/odoo#87116 X-original-commit: c9ff9d28ab75c02093ca54d9fbd1d2e203c5ee2e Signed-off-by: Josse Colpaert Signed-off-by: Grazioso Andrea (agr) --- addons/l10n_cl/models/account_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 4d02b00e19e..a3c6f5c22ee 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -20,7 +20,11 @@ class AccountMove(models.Model): self.journal_id.l10n_latam_use_documents: return super()._get_l10n_latam_documents_domain() if self.journal_id.type == 'sale': - domain = [('country_id.code', '=', "CL"), ('internal_type', '!=', 'invoice_in')] + if self.move_type == 'out_refund': + internal_types_domain = ('internal_type', '=', 'credit_note') + else: + internal_types_domain = ('internal_type', 'not in', ['invoice_in', 'credit_note']) + domain = [('country_id.code', '=', 'CL'), internal_types_domain] if self.company_id.partner_id.l10n_cl_sii_taxpayer_type == '1': domain += [('code', '!=', '71')] # Companies with VAT Affected doesn't have "Boleta de honorarios Electrónica" return domain