From a542cb3b3d1232f0e2dec58a220a4b35fb76cc7f Mon Sep 17 00:00:00 2001 From: Daniel Blanco Date: Wed, 11 May 2022 04:20:04 +0000 Subject: [PATCH] [FIX] l10n_cl: adjust domain for vendor bills to exclude credit notes from in_invoice type this fixes the domain of document types for vendor bills, (was failing since it included invoices as a document type as option for credit notes in the wizard and also fixes the opposite (credit notes in invoices generation) closes odoo/odoo#98002 X-original-commit: 1a8a6c369b257bef87bc3efe62fc9b764a02ebf1 Related: odoo/enterprise#30368 Signed-off-by: Josse Colpaert --- addons/l10n_cl/models/account_move.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 39e6ce41aa3..627c3d5e3e7 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -20,18 +20,18 @@ class AccountMove(models.Model): self.journal_id.l10n_latam_use_documents: return super()._get_l10n_latam_documents_domain() if self.journal_id.type == 'sale': - if self.move_type == 'out_refund': - internal_types_domain = ('internal_type', '=', 'credit_note') - else: - internal_types_domain = ('internal_type', 'in', ['invoice', 'debit_note']) - domain = [('country_id.code', '=', 'CL'), internal_types_domain] + domain = [('country_id.code', '=', 'CL')] + if self.move_type in ['in_invoice', 'out_invoice']: + domain += [('internal_type', 'in', ['invoice', 'debit_note', 'invoice_in'])] + elif self.move_type in ['in_refund', 'out_refund']: + domain += [('internal_type', '=', 'credit_note')] 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']) + internal_types_domain = ('internal_type', 'in', ['invoice', 'debit_note', 'invoice_in']) domain = [ ('country_id.code', '=', 'CL'), internal_types_domain, @@ -40,8 +40,6 @@ class AccountMove(models.Model): 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': domain += [('code', 'not in', ['39', '70', '71'])] - if self.move_type == 'in_invoice': - domain += [('internal_type', '!=', 'credit_note')] elif self.partner_id.l10n_cl_sii_taxpayer_type == '2': domain += [('code', 'in', ['70', '71', '56', '61'])] elif self.partner_id.l10n_cl_sii_taxpayer_type == '3':