[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 <jco@odoo.com>
This commit is contained in:
Daniel Blanco
2022-08-16 11:39:57 +02:00
committed by Josse Colpaert
parent 3999d2055f
commit a542cb3b3d
+6 -8
View File
@@ -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':