From 355250d062fb8dde558d21ea861b9af578545fe0 Mon Sep 17 00:00:00 2001 From: Luis Torres Date: Tue, 20 Jun 2023 16:58:01 +0000 Subject: [PATCH] [IMP] l10n_pe_edi: Improve sales invoice document type selection The domain to document type on the invoice has been updated to filter based on the partner's identification type. If the partner identification type is RUC, the default document type is set to 'Factura', but allows assign Boleta if its necessary; for all other partner identification types, the domain document type only allows 'Boleta'. Task latam: https://latam-localizations.odoo.com/web#id=916&menu_id=88&cids=1&action=188&model=project.task&view_type=form closes odoo/odoo#126760 Related: odoo/enterprise#44302 Signed-off-by: Josse Colpaert --- addons/l10n_pe/models/account_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/l10n_pe/models/account_move.py b/addons/l10n_pe/models/account_move.py index a0a143ed983..458e885e761 100644 --- a/addons/l10n_pe/models/account_move.py +++ b/addons/l10n_pe/models/account_move.py @@ -13,6 +13,8 @@ class AccountMove(models.Model): return result if self.journal_id.type == "sale": 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)) return result @api.onchange('l10n_latam_document_type_id', 'l10n_latam_document_number')