[FIX] l10n_pe: Fixed document type domain for not sale documents

In the commit 355250d062 was improved the
domain, to filter based in the document type, but was not considered
that only is for sales documents.

On the vendor bills could be used more document types, now is fixed.

closes odoo/odoo#139409

X-original-commit: e4a54d9a6988812e40b9054b8b5f4308d97cbff9
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Luis Torres
2023-10-21 02:22:48 +00:00
parent 25e4fcdd1d
commit 7414b6b850
+2 -3
View File
@@ -9,10 +9,9 @@ class AccountMove(models.Model):
def _get_l10n_latam_documents_domain(self):
self.ensure_one()
result = super()._get_l10n_latam_documents_domain()
if self.company_id.country_id.code != "PE" or not self.journal_id.l10n_latam_use_documents:
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
if self.journal_id.type == "sale":
result.append(("code", "in", ("01", "03", "07", "08", "20", "40")))
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