mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] splitted reservation prepare reservation/service lines
This commit is contained in:
@@ -431,8 +431,8 @@ class HotelReservation(models.Model):
|
|||||||
real_checkout = vals['real_checkout'] if 'real_checkout' in vals else record.real_checkout
|
real_checkout = vals['real_checkout'] if 'real_checkout' in vals else record.real_checkout
|
||||||
|
|
||||||
days_diff = (
|
days_diff = (
|
||||||
fields.Date.from_string(real_checkout) - \
|
fields.Date.from_string(checkout) - \
|
||||||
fields.Date.from_string(real_checkin)
|
fields.Date.from_string(checkin)
|
||||||
).days
|
).days
|
||||||
if self.compute_board_services(vals):
|
if self.compute_board_services(vals):
|
||||||
record.service_ids.filtered(lambda r: r.is_board_service == True).unlink()
|
record.service_ids.filtered(lambda r: r.is_board_service == True).unlink()
|
||||||
@@ -452,16 +452,20 @@ class HotelReservation(models.Model):
|
|||||||
if record.compute_price_out_vals(vals):
|
if record.compute_price_out_vals(vals):
|
||||||
pricelist_id = vals['pricelist_id'] if 'pricelist_id' in vals else record.pricelist_id.id
|
pricelist_id = vals['pricelist_id'] if 'pricelist_id' in vals else record.pricelist_id.id
|
||||||
record.update(record.prepare_reservation_lines(
|
record.update(record.prepare_reservation_lines(
|
||||||
real_checkin,
|
checkin,
|
||||||
days_diff,
|
days_diff,
|
||||||
pricelist_id,
|
pricelist_id,
|
||||||
vals=vals)) #REVISAR el unlink
|
vals=vals)) #REVISAR el unlink
|
||||||
if record.compute_qty_service_day(vals):
|
if record.compute_qty_service_day(vals):
|
||||||
|
service_days_diff = (
|
||||||
|
fields.Date.from_string(real_checkout) - \
|
||||||
|
fields.Date.from_string(real_checkin)
|
||||||
|
).days
|
||||||
for service in record.service_ids:
|
for service in record.service_ids:
|
||||||
if service.product_id.per_day:
|
if service.product_id.per_day:
|
||||||
service.update(service.prepare_service_lines(
|
service.update(service.prepare_service_lines(
|
||||||
dfrom=real_checkin,
|
dfrom=real_checkin,
|
||||||
days=days_diff,
|
days=service_days_diff,
|
||||||
per_person=service.product_id.per_person,
|
per_person=service.product_id.per_person,
|
||||||
persons=service.ser_room_line.adults,
|
persons=service.ser_room_line.adults,
|
||||||
old_line_days=service.service_line_ids,
|
old_line_days=service.service_line_ids,
|
||||||
|
|||||||
@@ -294,7 +294,12 @@ class HotelService(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
if record.per_day and record.ser_room_line:
|
if record.per_day and record.ser_room_line:
|
||||||
product = record.product_id
|
product = record.product_id
|
||||||
reservation = record.ser_room_line
|
if self.env.context.get('default_ser_room_line'):
|
||||||
|
reservation = self.env['hotel.reservation'].browse(
|
||||||
|
self.env.context.get('default_ser_room_line')
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
reservation = record.ser_room_line
|
||||||
if reservation.splitted:
|
if reservation.splitted:
|
||||||
checkin = reservation.real_checkin
|
checkin = reservation.real_checkin
|
||||||
checkout = reservation.real_checkout
|
checkout = reservation.real_checkout
|
||||||
|
|||||||
Reference in New Issue
Block a user