Skip to content

Commit

Permalink
[IMP]14.0-pms_api_rest: document country field added to checkin partn…
Browse files Browse the repository at this point in the history
…er datamodel & priority field in document type datamodel
  • Loading branch information
braisab authored and DarioLodeiros committed Apr 2, 2024
1 parent a1788a3 commit 9bb7324
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions pms_api_rest/datamodels/pms_checkin_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class PmsCheckinPartnerInfo(Datamodel):
documentNumber = fields.String(required=False, allow_none=True)
documentExpeditionDate = fields.String(required=False, allow_none=True)
documentSupportNumber = fields.String(required=False, allow_none=True)
documentCountryId = fields.Integer(required=False, allow_none=True)
gender = fields.String(required=False, allow_none=True)
birthdate = fields.String(required=False, allow_none=True)
residenceStreet = fields.String(required=False, allow_none=True)
Expand Down
1 change: 1 addition & 0 deletions pms_api_rest/datamodels/pms_id_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ class PmsIdCategoryInfo(Datamodel):
id = fields.Integer(required=False, allow_none=True)
documentType = fields.String(required=False, allow_none=True)
code = fields.String(required=False, allow_none=True)
countryIds = fields.List(fields.Integer(), required=False, allow_none=True)
3 changes: 2 additions & 1 deletion pms_api_rest/services/pms_id_category_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ def get_id_categories(self):
for id_category in (
self.env["res.partner.id_category"]
.with_context(lang=self.env.user.lang)
.search([])
.search([], order="priority asc")
):
result_id_categories.append(
PmsIdCategoryInfo(
id=id_category.id,
documentType=id_category.name,
code=id_category.code,
countryIds=id_category.country_ids.mapped("id"),
)
)
return result_id_categories
1 change: 1 addition & 0 deletions pms_api_rest/services/pms_partner_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ def get_partner_by_doc_number(self, document_type, document_number):
doc_number.valid_from, datetime.min.time()
).isoformat() if doc_number.valid_from else None,
documentSupportNumber=doc_number.support_number or None,
documentCountryId=doc_number.country_id.id or None,
gender=partner.gender or None,
birthdate=datetime.combine(
partner.birthdate_date, datetime.min.time()
Expand Down
4 changes: 4 additions & 0 deletions pms_api_rest/services/pms_reservation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ def get_checkin_partners(self, reservation_id):
documentSupportNumber=checkin_partner.support_number
if checkin_partner.support_number
else None,
documentCountryId=checkin_partner.document_country_id.id
if checkin_partner.document_country_id
else None,
gender=checkin_partner.gender if checkin_partner.gender else "",
birthdate=datetime.combine(
checkin_partner.birthdate_date, datetime.min.time()
Expand Down Expand Up @@ -890,6 +893,7 @@ def mapping_checkin_partner_values(self, pms_checkin_partner_info, partner_id=Fa
"mobile": pms_checkin_partner_info.mobile,
"document_type": pms_checkin_partner_info.documentType,
"document_number": pms_checkin_partner_info.documentNumber,
"document_country_id": pms_checkin_partner_info.documentCountryId,
"support_number": pms_checkin_partner_info.documentSupportNumber,
"gender": pms_checkin_partner_info.gender,
"residence_street": pms_checkin_partner_info.residenceStreet,
Expand Down

0 comments on commit 9bb7324

Please sign in to comment.