[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 <jco@odoo.com>
This commit is contained in:
Luis Torres
2023-07-19 00:35:21 +02:00
parent d888d2953f
commit 355250d062
+2
View File
@@ -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')