From 815b754ed2bc9cdaafe98691c1d2ab2d1010b27e Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Mon, 4 Apr 2022 14:20:43 +0000 Subject: [PATCH] [FIX] l10n_cl: unable to issue credit note (vendor bill) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Have a CL company setup Issue a vendor bill Then generate the credit note via 'Add Credit Note' wizard Add a reason and confirm Error will raise “You can not use a invoice document type with a refund invoice” As https://github.com/odoo/odoo/commit/c9ff9d28ab75c02093ca54d9fbd1d2e203c5ee2e for the invoice case we need to add specific logic to handle credit notes in l10n_cl opw-2801576 closes odoo/odoo#87946 X-original-commit: 0f1edf4d47d936c440e42fa105a8a5d6a75a8a77 Signed-off-by: Josse Colpaert Signed-off-by: Grazioso Andrea (agr) --- addons/l10n_cl/models/account_move.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 5e790f15b5f..95863b63b93 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -28,9 +28,14 @@ class AccountMove(models.Model): 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 + if self.move_type == 'in_refund': + internal_types_domain = ('internal_type', '=', 'credit_note') + else: + internal_types_domain = ('internal_type', 'in', ['invoice', 'debit_note', 'credit_note', 'invoice_in']) domain = [ ('country_id.code', '=', 'CL'), - ('internal_type', 'in', ['invoice', 'debit_note', 'credit_note', 'invoice_in'])] + internal_types_domain, + ] if self.partner_id.l10n_cl_sii_taxpayer_type == '1' and self.partner_id_vat != '60805000-0': domain += [('code', 'not in', ['39', '70', '71', '914', '911'])] elif self.partner_id.l10n_cl_sii_taxpayer_type == '1' and self.partner_id_vat == '60805000-0':