Merge PR #106 into 14.0

Signed-off-by DarioLodeiros
This commit is contained in:
OCA-git-bot
2021-12-18 16:20:25 +00:00
3 changed files with 9 additions and 2 deletions

View File

@@ -418,7 +418,7 @@ class PmsProperty(models.Model):
tz_property = self.tz
dt = pytz.timezone(tz_property).localize(dt)
dt = dt.replace(tzinfo=None)
dt = pytz.timezone(self.env.user.tz).localize(dt)
dt = pytz.timezone(self.env.user.tz or "UTC").localize(dt)
dt = dt.astimezone(pytz.utc)
dt = dt.replace(tzinfo=None)
return dt

View File

@@ -940,9 +940,15 @@ class PmsReservation(models.Model):
reservation.pricelist_id = (
reservation.agency_id.property_product_pricelist
)
# only change de pricelist if the reservation is not yet saved
# and the partner has a pricelist default
elif (
reservation.partner_id
and reservation.partner_id.property_product_pricelist
and (
not reservation.pricelist_id
or not isinstance(reservation.id, models.NewId)
)
):
reservation.pricelist_id = (
reservation.partner_id.property_product_pricelist

View File

@@ -424,13 +424,14 @@ class AvailabilityWizard(models.TransientModel):
):
room_type_total_price_per_room = 0
room_type = self.env["pms.room.type"].browse(room_type_id)
pms_property = self.env["pms.property"].browse(pms_property_id)
for date_iterator in [
checkin + datetime.timedelta(days=x)
for x in range(0, (checkout - checkin).days)
]:
product = room_type.product_id
product = product.with_context(
product = product.with_company(pms_property.company_id).with_context(
quantity=1,
date=fields.Date.today(),
consumption_date=date_iterator,