From 6a255786ab543644d53e7a34fe52b40abdaa8cd8 Mon Sep 17 00:00:00 2001 From: Luis Torres Date: Fri, 5 Jan 2024 00:34:01 +0000 Subject: [PATCH] [FIX] l10n_pe: Add domain 01 for export refunds In commit 355250d, the domain was adjusted to automatically select the invoice document type for customers with a RUC and limit others to the "boleta" document type. This generally holds true, except for export invoices requiring the 01 document type. This commit addresses the current restriction, allowing the selection of document type 01 other than "credit note boleta." closes odoo/odoo#154511 Related: odoo/enterprise#56465 Signed-off-by: Laurent Smet (las) --- addons/l10n_pe/models/account_move.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/l10n_pe/models/account_move.py b/addons/l10n_pe/models/account_move.py index 54d54f69335..e03d4929bf0 100644 --- a/addons/l10n_pe/models/account_move.py +++ b/addons/l10n_pe/models/account_move.py @@ -12,8 +12,12 @@ class AccountMove(models.Model): if self.company_id.country_id.code != "PE" or not self.journal_id.l10n_latam_use_documents or self.journal_id.type != "sale": return result result.append(("code", "in", ("01", "03", "07", "08", "20", "40"))) - if self.partner_id.l10n_latam_identification_type_id.l10n_pe_vat_code != '6': - result.append(('id', 'in', (self.env.ref('l10n_pe.document_type08b') | self.env.ref('l10n_pe.document_type02') | self.env.ref('l10n_pe.document_type07b')).ids)) + if self.partner_id.l10n_latam_identification_type_id.l10n_pe_vat_code != '6' and self.move_type == 'out_invoice': + result.append(('id', 'in', ( + self.env.ref('l10n_pe.document_type08b') + | self.env.ref('l10n_pe.document_type02') + | self.env.ref('l10n_pe.document_type07b') + ).ids)) return result @api.onchange('l10n_latam_document_type_id', 'l10n_latam_document_number')