mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: overwrites reservation pricelist saved, company price forced context
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user