[FIX] pms: fix doc_type save correctly in precheckin portal

This commit is contained in:
Sara Lago
2022-11-15 14:46:54 +01:00
committed by Darío Lodeiros
parent 6de69e01fb
commit b6b0e72faf

View File

@@ -886,6 +886,12 @@ class PmsCheckinPartner(models.Model):
values.update({"nationality_id": False})
if not values.get("document_type"):
values.update({"document_type": False})
else:
doc_type_name = values.get("document_type")
doc_type = self.env["res.partner.id_category"].search(
[("name", "=", doc_type_name)]
)
values.update({"document_type": doc_type})
if values.get("state"):
residence_state_id = self.env["res.country.state"].search(
[("id", "=", values.get("state"))]
@@ -893,10 +899,6 @@ class PmsCheckinPartner(models.Model):
values.update({"residence_state_id": residence_state_id})
values.pop("state")
if values.get("document_expedition_date"):
doc_type = values.get("document_type")
doc_type = self.env["res.partner.id_category"].search(
[("code", "=", doc_type)]
)
doc_date = values.get("document_expedition_date")
birthdate = values.get("birthdate_date")
document_expedition_date = (
@@ -907,7 +909,6 @@ class PmsCheckinPartner(models.Model):
values.update(
{
"document_expedition_date": document_expedition_date,
"document_type": doc_type,
}
)