diff --git a/pms/models/pms_property.py b/pms/models/pms_property.py index 7f2be5011..c3e7e70c4 100644 --- a/pms/models/pms_property.py +++ b/pms/models/pms_property.py @@ -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 diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index d915bfb0b..97f79ea81 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -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 diff --git a/pms/wizards/pms_booking_engine.py b/pms/wizards/pms_booking_engine.py index 878a9ed0f..aaafbe239 100644 --- a/pms/wizards/pms_booking_engine.py +++ b/pms/wizards/pms_booking_engine.py @@ -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,