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)
|
residenceCity = fields.String(required=False, allow_none=True)
|
||||||
nationality = fields.Integer(required=False, allow_none=True)
|
nationality = fields.Integer(required=False, allow_none=True)
|
||||||
countryState = 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)
|
checkinPartnerState = fields.String(required=False, allow_none=True)
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ from odoo.addons.datamodel.core import Datamodel
|
|||||||
class ResCityZipInfo(Datamodel):
|
class ResCityZipInfo(Datamodel):
|
||||||
_name = "res.city.zip.info"
|
_name = "res.city.zip.info"
|
||||||
cityId = fields.String(required=False, allow_none=True)
|
cityId = fields.String(required=False, allow_none=True)
|
||||||
stateId = fields.String(required=False, allow_none=True)
|
stateId = fields.Integer(required=False, allow_none=True)
|
||||||
countryId = fields.String(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
|
nationality=doc_number.partner_id.nationality_id.id
|
||||||
if doc_number.partner_id.nationality_id
|
if doc_number.partner_id.nationality_id
|
||||||
else None,
|
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
|
countryState=doc_number.partner_id.residence_state_id.id
|
||||||
if doc_number.partner_id.residence_state_id
|
if doc_number.partner_id.residence_state_id
|
||||||
else None,
|
else None,
|
||||||
|
|||||||
@@ -512,6 +512,9 @@ class PmsReservationService(Component):
|
|||||||
countryState=checkin_partner.residence_state_id.id
|
countryState=checkin_partner.residence_state_id.id
|
||||||
if checkin_partner.residence_state_id
|
if checkin_partner.residence_state_id
|
||||||
else None,
|
else None,
|
||||||
|
countryId=checkin_partner.residence_country_id.id
|
||||||
|
if checkin_partner.residence_country_id
|
||||||
|
else None,
|
||||||
checkinPartnerState=checkin_partner.state,
|
checkinPartnerState=checkin_partner.state,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -673,7 +676,7 @@ class PmsReservationService(Component):
|
|||||||
"residence_zip": pms_checkin_partner_info.zip,
|
"residence_zip": pms_checkin_partner_info.zip,
|
||||||
"residence_city": pms_checkin_partner_info.residenceCity,
|
"residence_city": pms_checkin_partner_info.residenceCity,
|
||||||
"residence_state_id": pms_checkin_partner_info.countryState,
|
"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:
|
if pms_checkin_partner_info.documentExpeditionDate:
|
||||||
document_expedition_date = datetime.strptime(
|
document_expedition_date = datetime.strptime(
|
||||||
|
|||||||
@@ -18,18 +18,19 @@ class ResCityZipService(Component):
|
|||||||
"GET",
|
"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",
|
auth="jwt_api_pms",
|
||||||
)
|
)
|
||||||
def get_address_data_by_zip(self, res_city_zip):
|
def get_address_data_by_zip(self, res_city_zip):
|
||||||
result_zip_data = []
|
|
||||||
ResCityZipInfo = self.env.datamodels["res.city.zip.info"]
|
ResCityZipInfo = self.env.datamodels["res.city.zip.info"]
|
||||||
for zip_code in self.env["res.city.zip"].search([("name", "=", res_city_zip)]):
|
res_zip = self.env["res.city.zip"].search([("name", "=", res_city_zip)])
|
||||||
result_zip_data.append(
|
if len(res_zip) > 1:
|
||||||
ResCityZipInfo(
|
res_zip = res_zip[0]
|
||||||
cityId=zip_code.city_id.name,
|
if res_zip:
|
||||||
stateId=zip_code.state_id.name,
|
return ResCityZipInfo(
|
||||||
countryId=zip_code.country_id.name,
|
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