[ADD]pms_api_rest: add otas parameter in get agency service

This commit is contained in:
Darío Lodeiros
2023-08-14 09:50:18 +02:00
parent 1c76e21a7c
commit 7623ab10ff
2 changed files with 3 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ from odoo.addons.datamodel.core import Datamodel
class PmsAgencySearchParam(Datamodel):
_name = "pms.agency.search.param"
name = fields.String(required=False, allow_none=True)
otas = fields.Boolean(required=False, allow_none=True)
class PmsAgencyInfo(Datamodel):

View File

@@ -27,6 +27,8 @@ class PmsAgencyService(Component):
)
def get_agencies(self, agencies_search_param):
domain = [("is_agency", "=", True)]
if agencies_search_param.otas:
domain.append(("sale_channel_id.is_on_line", "=", True))
if agencies_search_param.name:
domain.append(("name", "like", agencies_search_param.name))
result_agencies = []