mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms_api_rest: added residence_country_id in checkin_partner datamodel and services
This commit is contained in:
@@ -24,4 +24,5 @@ class PmsCheckinPartnerInfo(Datamodel):
|
||||
residenceCity = fields.String(required=False, allow_none=True)
|
||||
nationality = fields.Integer(required=False, allow_none=True)
|
||||
countryState = fields.Integer(required=False, allow_none=True)
|
||||
countryId = fields.Integer(required=False, allow_none=True)
|
||||
checkinPartnerState = fields.String(required=False, allow_none=True)
|
||||
|
||||
@@ -6,5 +6,5 @@ from odoo.addons.datamodel.core import Datamodel
|
||||
class ResCityZipInfo(Datamodel):
|
||||
_name = "res.city.zip.info"
|
||||
cityId = fields.String(required=False, allow_none=True)
|
||||
stateId = fields.String(required=False, allow_none=True)
|
||||
countryId = fields.String(required=False, allow_none=True)
|
||||
stateId = fields.Integer(required=False, allow_none=True)
|
||||
countryId = fields.Integer(required=False, allow_none=True)
|
||||
|
||||
@@ -334,6 +334,9 @@ class PmsPartnerService(Component):
|
||||
nationality=doc_number.partner_id.nationality_id.id
|
||||
if doc_number.partner_id.nationality_id
|
||||
else None,
|
||||
countryId=doc_number.partner_id.residence_country_id
|
||||
if doc_number.partner_id.residence_country_id
|
||||
else None,
|
||||
countryState=doc_number.partner_id.residence_state_id.id
|
||||
if doc_number.partner_id.residence_state_id
|
||||
else None,
|
||||
|
||||
@@ -512,6 +512,9 @@ class PmsReservationService(Component):
|
||||
countryState=checkin_partner.residence_state_id.id
|
||||
if checkin_partner.residence_state_id
|
||||
else None,
|
||||
countryId=checkin_partner.residence_country_id.id
|
||||
if checkin_partner.residence_country_id
|
||||
else None,
|
||||
checkinPartnerState=checkin_partner.state,
|
||||
)
|
||||
)
|
||||
@@ -673,7 +676,7 @@ class PmsReservationService(Component):
|
||||
"residence_zip": pms_checkin_partner_info.zip,
|
||||
"residence_city": pms_checkin_partner_info.residenceCity,
|
||||
"residence_state_id": pms_checkin_partner_info.countryState,
|
||||
"residence_country_id": pms_checkin_partner_info.nationality,
|
||||
"residence_country_id": pms_checkin_partner_info.countryId,
|
||||
}
|
||||
if pms_checkin_partner_info.documentExpeditionDate:
|
||||
document_expedition_date = datetime.strptime(
|
||||
|
||||
@@ -18,18 +18,19 @@ class ResCityZipService(Component):
|
||||
"GET",
|
||||
)
|
||||
],
|
||||
output_param=Datamodel("res.city.zip.info", is_list=True),
|
||||
output_param=Datamodel("res.city.zip.info", is_list=False),
|
||||
auth="jwt_api_pms",
|
||||
)
|
||||
def get_address_data_by_zip(self, res_city_zip):
|
||||
result_zip_data = []
|
||||
ResCityZipInfo = self.env.datamodels["res.city.zip.info"]
|
||||
for zip_code in self.env["res.city.zip"].search([("name", "=", res_city_zip)]):
|
||||
result_zip_data.append(
|
||||
ResCityZipInfo(
|
||||
cityId=zip_code.city_id.name,
|
||||
stateId=zip_code.state_id.name,
|
||||
countryId=zip_code.country_id.name,
|
||||
)
|
||||
res_zip = self.env["res.city.zip"].search([("name", "=", res_city_zip)])
|
||||
if len(res_zip) > 1:
|
||||
res_zip = res_zip[0]
|
||||
if res_zip:
|
||||
return ResCityZipInfo(
|
||||
cityId=res_zip.city_id.name,
|
||||
stateId=res_zip.state_id.id,
|
||||
countryId=res_zip.country_id.id,
|
||||
)
|
||||
return result_zip_data
|
||||
else:
|
||||
return ResCityZipInfo()
|
||||
|
||||
Reference in New Issue
Block a user