mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] State on split Reservations
This commit is contained in:
@@ -389,9 +389,12 @@ class HotelReservation(models.Model):
|
|||||||
if 'checkout' in vals:
|
if 'checkout' in vals:
|
||||||
vals['real_checkout'] = vals['checkout']
|
vals['real_checkout'] = vals['checkout']
|
||||||
|
|
||||||
|
real_checkin = vals['real_checkin'] if 'real_checkin' in vals else record.real_checkin
|
||||||
|
real_checkout = vals['real_checkout'] if 'real_checkout' in vals else record.real_checkout
|
||||||
|
|
||||||
days_diff = (
|
days_diff = (
|
||||||
fields.Date.from_string(checkout) - \
|
fields.Date.from_string(real_checkout) - \
|
||||||
fields.Date.from_string(checkin)
|
fields.Date.from_string(real_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()
|
||||||
@@ -410,7 +413,7 @@ 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(
|
||||||
checkin,
|
real_checkin,
|
||||||
days_diff,
|
days_diff,
|
||||||
pricelist_id,
|
pricelist_id,
|
||||||
vals=vals)) #REVISAR el unlink
|
vals=vals)) #REVISAR el unlink
|
||||||
@@ -418,7 +421,7 @@ class HotelReservation(models.Model):
|
|||||||
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=checkin,
|
dfrom=real_checkin,
|
||||||
days=days_diff,
|
days=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,
|
||||||
@@ -756,7 +759,6 @@ class HotelReservation(models.Model):
|
|||||||
@param self: object pointer
|
@param self: object pointer
|
||||||
'''
|
'''
|
||||||
_logger.info('confirm')
|
_logger.info('confirm')
|
||||||
hotel_folio_obj = self.env['hotel.folio']
|
|
||||||
hotel_reserv_obj = self.env['hotel.reservation']
|
hotel_reserv_obj = self.env['hotel.reservation']
|
||||||
for record in self:
|
for record in self:
|
||||||
vals = {}
|
vals = {}
|
||||||
@@ -775,8 +777,10 @@ class HotelReservation(models.Model):
|
|||||||
('id', '=', master_reservation.id),
|
('id', '=', master_reservation.id),
|
||||||
('folio_id', '=', record.folio_id.id),
|
('folio_id', '=', record.folio_id.id),
|
||||||
('id', '!=', record.id),
|
('id', '!=', record.id),
|
||||||
('state', '!=', 'confirm')
|
('state', 'not in', ('confirm', 'booking'))
|
||||||
])
|
])
|
||||||
|
if master_reservation.checkin_partner_ids:
|
||||||
|
record.update({'state': 'booking'})
|
||||||
splitted_reservs.confirm()
|
splitted_reservs.confirm()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1111,7 +1115,9 @@ class HotelReservation(models.Model):
|
|||||||
'parent_reservation': parent_res.id,
|
'parent_reservation': parent_res.id,
|
||||||
'room_type_id': parent_res.room_type_id.id,
|
'room_type_id': parent_res.room_type_id.id,
|
||||||
'discount': parent_res.discount,
|
'discount': parent_res.discount,
|
||||||
|
'state': parent_res.state,
|
||||||
'reservation_line_ids': reservation_lines[1],
|
'reservation_line_ids': reservation_lines[1],
|
||||||
|
'preconfirm': False,
|
||||||
})
|
})
|
||||||
reservation_copy = self.env['hotel.reservation'].with_context({
|
reservation_copy = self.env['hotel.reservation'].with_context({
|
||||||
'ignore_avail_restrictions': True}).create(vals)
|
'ignore_avail_restrictions': True}).create(vals)
|
||||||
|
|||||||
@@ -169,10 +169,12 @@ class HotelService(models.Model):
|
|||||||
if self.compute_lines_out_vals(vals):
|
if self.compute_lines_out_vals(vals):
|
||||||
reservation = self.env['hotel.reservation'].browse(vals['ser_room_line'])
|
reservation = self.env['hotel.reservation'].browse(vals['ser_room_line'])
|
||||||
product = self.env['product.product'].browse(vals['product_id'])
|
product = self.env['product.product'].browse(vals['product_id'])
|
||||||
|
checkin_dt = fields.Date.from_string(reservation.real_checkin)
|
||||||
|
checkout_dt = fields.Date.from_string(reservation.real_checkout)
|
||||||
|
nights = abs((checkout_dt - checkin_dt).days)
|
||||||
vals.update(self.prepare_service_lines(
|
vals.update(self.prepare_service_lines(
|
||||||
dfrom=reservation.checkin,
|
dfrom=reservation.real_checkin,
|
||||||
days=reservation.nights,
|
days=nights,
|
||||||
per_person=product.per_person,
|
per_person=product.per_person,
|
||||||
persons=reservation.adults,
|
persons=reservation.adults,
|
||||||
old_day_lines=False,
|
old_day_lines=False,
|
||||||
@@ -195,9 +197,12 @@ class HotelService(models.Model):
|
|||||||
reservations = self.env['hotel.reservation']
|
reservations = self.env['hotel.reservation']
|
||||||
reservation = reservations.browse(vals['ser_room_line']) \
|
reservation = reservations.browse(vals['ser_room_line']) \
|
||||||
if 'ser_room_line' in vals else record.ser_room_line
|
if 'ser_room_line' in vals else record.ser_room_line
|
||||||
|
checkin_dt = fields.Date.from_string(reservation.real_checkin)
|
||||||
|
checkout_dt = fields.Date.from_string(reservation.real_checkout)
|
||||||
|
nights = abs((checkout_dt - checkin_dt).days)
|
||||||
record.update(record.prepare_service_lines(
|
record.update(record.prepare_service_lines(
|
||||||
dfrom=reservation.checkin,
|
dfrom=reservation.real_checkin,
|
||||||
days=reservation.nights,
|
days=nights,
|
||||||
per_person=product.per_person,
|
per_person=product.per_person,
|
||||||
persons=reservation.adults,
|
persons=reservation.adults,
|
||||||
old_line_days=self.service_line_ids
|
old_line_days=self.service_line_ids
|
||||||
@@ -272,9 +277,12 @@ class HotelService(models.Model):
|
|||||||
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
|
reservation = record.ser_room_line
|
||||||
|
checkin_dt = fields.Date.from_string(reservation.real_checkin)
|
||||||
|
checkout_dt = fields.Date.from_string(reservation.real_checkout)
|
||||||
|
nights = abs((checkout_dt - checkin_dt).days)
|
||||||
vals.update(record.prepare_service_lines(
|
vals.update(record.prepare_service_lines(
|
||||||
dfrom=reservation.checkin,
|
dfrom=reservation.real_checkin,
|
||||||
days=reservation.nights,
|
days=nights,
|
||||||
per_person=product.per_person,
|
per_person=product.per_person,
|
||||||
persons=reservation.adults,
|
persons=reservation.adults,
|
||||||
old_line_days=record.service_line_ids))
|
old_line_days=record.service_line_ids))
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
('hotel_room_type_id', '=', room_type_id),
|
('hotel_room_type_id', '=', room_type_id),
|
||||||
('pricelist_id', 'in', [pricelist_id, False])]"
|
('pricelist_id', 'in', [pricelist_id, False])]"
|
||||||
options="{'no_create': True,'no_open': True}"
|
options="{'no_create': True,'no_open': True}"
|
||||||
attrs="{'invisible': [('reservation_type','in',('out'))]}" />
|
attrs="{'invisible': ['|',('reservation_type','in',('out')),('parent_reservation','!=',False)]}" />
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="adults" attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
<field name="adults" attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
||||||
<field name="children" attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
<field name="children" attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
||||||
@@ -234,7 +234,8 @@
|
|||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
<page name="services" string="Services"
|
<page name="services" string="Services"
|
||||||
attrs="{'invisible': [('reservation_type','in',('out'))]}">
|
attrs="{'invisible': ['|',('reservation_type','in',('out')),
|
||||||
|
('parent_reservation','!=',False)]}">
|
||||||
<group string="Reservation Services" name="reservation_services">
|
<group string="Reservation Services" name="reservation_services">
|
||||||
<field name="service_ids"
|
<field name="service_ids"
|
||||||
context="{'default_ser_room_line': active_id, 'default_folio_id': folio_id, 'form_view_ref':'hotel.hotel_service_view_form'}"
|
context="{'default_ser_room_line': active_id, 'default_folio_id': folio_id, 'form_view_ref':'hotel.hotel_service_view_form'}"
|
||||||
@@ -290,7 +291,8 @@
|
|||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
<page name="persons" string="Persons"
|
<page name="persons" string="Persons"
|
||||||
attrs="{'invisible': [('reservation_type','in',('out'))]}">
|
attrs="{'invisible': ['|',('reservation_type','in',('out')),
|
||||||
|
('parent_reservation','!=',False)]}">
|
||||||
<group>
|
<group>
|
||||||
<field name="segmentation_ids" widget="many2many_tags" placeholder="Segmentation..."
|
<field name="segmentation_ids" widget="many2many_tags" placeholder="Segmentation..."
|
||||||
options="{'no_create': True,'no_open': True}" />
|
options="{'no_create': True,'no_open': True}" />
|
||||||
@@ -304,7 +306,8 @@
|
|||||||
/>
|
/>
|
||||||
</page>
|
</page>
|
||||||
<page name="invoicing" string="Invoicing"
|
<page name="invoicing" string="Invoicing"
|
||||||
attrs="{'invisible': [('reservation_type','in',('out'))]}">
|
attrs="{'invisible': ['|',('reservation_type','in',('out')),
|
||||||
|
('parent_reservation','!=',False)]}">
|
||||||
<group>
|
<group>
|
||||||
<field name="partner_diff_invoicing" string="Bill to another Address"/>
|
<field name="partner_diff_invoicing" string="Bill to another Address"/>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user