[FIX]pms_api_rest: fix comparation vat len in partners without vat

This commit is contained in:
Darío Lodeiros
2023-02-07 08:59:39 +01:00
parent 1a16d09f5e
commit 10d313087f

View File

@@ -91,7 +91,11 @@ class PmsCheckinPartner(models.Model):
],
limit=1,
)
if partner and len(partner.vat) - len(document_number) > 2:
if (
partner
and partner.vat
and len(partner.vat) - len(document_number) > 2
):
# The country code length is 2, so if the difference is greater than 2
# the partner is not the same
# TODO: this method need pass country code to search