mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms_api_rest: fixed avail rules and pricelist items post
This commit is contained in:
@@ -158,24 +158,22 @@ class PmsAvailabilityPlanService(Component):
|
||||
):
|
||||
for avail_plan_rule in pms_avail_plan_rules_info.availabilityPlanRules:
|
||||
vals = dict()
|
||||
date = datetime.strptime(avail_plan_rule.date[:10], "%Y-%m-%d") + timedelta(
|
||||
days=1
|
||||
)
|
||||
if avail_plan_rule.minStay:
|
||||
date = datetime.strptime(avail_plan_rule.date, "%Y-%m-%d").date()
|
||||
if avail_plan_rule.minStay is not None:
|
||||
vals.update({"min_stay": avail_plan_rule.minStay})
|
||||
if avail_plan_rule.minStayArrival:
|
||||
if avail_plan_rule.minStayArrival is not None:
|
||||
vals.update({"min_stay_arrival": avail_plan_rule.minStayArrival})
|
||||
if avail_plan_rule.maxStay:
|
||||
if avail_plan_rule.maxStay is not None:
|
||||
vals.update({"max_stay": avail_plan_rule.maxStay})
|
||||
if avail_plan_rule.maxStayArrival:
|
||||
if avail_plan_rule.maxStayArrival is not None:
|
||||
vals.update({"max_stay_arrival": avail_plan_rule.maxStayArrival})
|
||||
if avail_plan_rule.closed:
|
||||
if avail_plan_rule.closed is not None:
|
||||
vals.update({"closed": avail_plan_rule.closed})
|
||||
if avail_plan_rule.closedDeparture:
|
||||
if avail_plan_rule.closedDeparture is not None:
|
||||
vals.update({"closed_departure": avail_plan_rule.closedDeparture})
|
||||
if avail_plan_rule.closedArrival:
|
||||
if avail_plan_rule.closedArrival is not None:
|
||||
vals.update({"closed_arrival": avail_plan_rule.closedArrival})
|
||||
if avail_plan_rule.quota:
|
||||
if avail_plan_rule.quota is not None:
|
||||
vals.update({"quota": avail_plan_rule.quota})
|
||||
avail_rule = self.env["pms.availability.plan.rule"].search(
|
||||
[
|
||||
|
||||
@@ -156,9 +156,7 @@ class PmsPricelistService(Component):
|
||||
)
|
||||
def create_pricelist_item(self, pricelist_id, pms_pricelist_item_info):
|
||||
for pms_pricelist_item in pms_pricelist_item_info.pricelistItems:
|
||||
date = datetime.strptime(
|
||||
pms_pricelist_item.date[:10], "%Y-%m-%d"
|
||||
) + timedelta(days=1)
|
||||
date = datetime.strptime(pms_pricelist_item.date, "%Y-%m-%d").date()
|
||||
product_id = (
|
||||
self.env["pms.room.type"]
|
||||
.browse(pms_pricelist_item.roomTypeId)
|
||||
|
||||
Reference in New Issue
Block a user