[WIP][MIG][11.0] Hotel Improvements + Hotel Calendar

This commit is contained in:
QS5ELkMu
2018-09-06 00:06:37 +02:00
parent 0c7b3edd77
commit 52562f7341
70 changed files with 509 additions and 533 deletions

View File

@@ -50,9 +50,9 @@
'views/reservation_restriction_views.xml',
'views/reservation_restriction_item_views.xml',
'views/hotel_reservation.xml',
# 'views/virtual_room_views.xml',
# 'views/room_type_views.xml',
'views/cardex.xml',
'views/virtual_room_availability.xml',
'views/room_type_availability.xml',
# 'views/hotel_dashboard.xml',
'data/cron_jobs.xml',
'data/records.xml',

View File

@@ -164,7 +164,7 @@
% endif
<br />
% for rline in object.get_grouped_reservations_json('cancelled'):
<strong>${rline['num']} x ${rline['virtual_room']['name']}
<strong>${rline['num']} x ${rline['room_type']['name']}
% if rline['childrens'] > 0:
(${rline['adults']} Adults + ${rline['childrens']} Childrens)
% else:

View File

@@ -257,7 +257,7 @@
<br />
% for rline in object.get_grouped_reservations_json('confirm'):
<strong>${rline['num']} x ${rline['virtual_room']['name']}
<strong>${rline['num']} x ${rline['room_type']['name']}
% if rline['childrens'] > 0:
(${rline['adults']} Adultos + ${rline['childrens']} Niños)
% else:
@@ -406,13 +406,13 @@
<tr>
<td class="h2" style="font-family: sans-serif; font-size: 18px; font-weight: bold; color: #C50967; padding: 0 0 0 0; text-transform: uppercase; letter-spacing: 0.5px;">Información de la habitación</td>
</tr>
% set vroom_ids = object.room_lines.filtered('to_send').mapped('virtual_room_id.id')
% set vrooms = user.env['hotel.virtual.room'].browse(vroom_ids)
% for vroom in vrooms:
% set room_type_ids = object.room_lines.filtered('to_send').mapped('room_type_id.id')
% set room_types = user.env['hotel.room.type'].browse(room_type_ids)
% for room_type in room_types:
<tr>
% if vroom.name:
% if room_type.name:
<td align="justify" class="subheading" style="color: #555555">
<strong>${vroom.name}</strong>
<strong>${room_type.name}</strong>
</td>
% else:
<td align="justify" class="subheading" style="color: #555555">

View File

@@ -19,7 +19,7 @@ from . import inherit_account_invoice
# from . import inherit_product_category
from . import inherit_product_product
from . import inherit_res_company
# from . import virtual_room
# from . import room_type
from . import inherit_account_payment
from . import hotel_room_type_restriction
from . import hotel_room_type_restriction_item

View File

@@ -10,7 +10,6 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
class CurrencyExchangeRate(models.Model):
_name = "currency.exchange"
_description = "currency"

View File

@@ -21,6 +21,10 @@ from odoo.addons import decimal_precision as dp
class HotelFolio(models.Model):
_name = 'hotel.folio'
_description = 'Hotel Folio'
_inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
_order = 'id'
# @api.depends('invoice_lines.invoice_id.state', 'invoice_lines.quantity')
def _get_invoice_qty(self):
@@ -41,12 +45,6 @@ class HotelFolio(models.Model):
def _amount_all(self):
pass
_name = 'hotel.folio'
_description = 'Hotel Folio'
_order = 'id'
_inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
name = fields.Char('Folio Number', readonly=True, index=True,
default=lambda self: _('New'))
partner_id = fields.Many2one('res.partner',

View File

@@ -16,6 +16,10 @@ _logger = logging.getLogger(__name__)
class HotelReservation(models.Model):
_name = 'hotel.reservation'
_description = 'Hotel Reservation'
_inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
_order = "last_updated_res desc, name"
def _get_default_checkin(self):
folio = False
@@ -110,11 +114,6 @@ class HotelReservation(models.Model):
fields.Date.from_string(res.checkout) - fields.Date.from_string(res.checkin)
).days
_name = 'hotel.reservation'
_description = 'Hotel Reservation'
_inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
_order = "last_updated_res desc, name"
name = fields.Text('Reservation Description', required=True)
room_id = fields.Many2one('hotel.room', string='Room')
@@ -312,9 +311,12 @@ class HotelReservation(models.Model):
})
for record in self:
if record.compute_price_out_vals(vals):
checkin = vals['checkin'] if 'checkin' in vals else record.checkin
checkout = vals['checkout'] if 'checkout' in vals else record.checkout
days_diff = (
fields.Date.from_string(record.checkout) - \
fields.Date.from_string(record.checkin)
fields.Date.from_string(checkout) - \
fields.Date.from_string(checkin)
).days
record.update(record.prepare_reservation_lines(
vals['checkin'],
@@ -390,7 +392,7 @@ class HotelReservation(models.Model):
'overbooking': self.overbooking,
'price_unit': self.price_unit,
'splitted': self.splitted,
# 'virtual_room_id': self.virtual_room_id.id,
# 'room_type_id': self.room_type_id.id,
'room_type_id': self.room_type_id.id,
}
@@ -419,7 +421,7 @@ class HotelReservation(models.Model):
#Si el registro no existe, modificar room_type aunque ya esté establecido
if not self.room_type_id:
write_vals.update({'room_type_id': self.room_id.room_type_id.id})
self.write(write_vals)
self.update(write_vals)
@api.onchange('partner_id')
def onchange_partner_id(self):

View File

@@ -7,6 +7,7 @@ from odoo import models, fields, api, _
class HotelRoomAmenities(models.Model):
_name = 'hotel.room.amenities'
_description = 'Room amenities'
# The record's name
name = fields.Char('Amenity Name', required=True)
# Used for activate records

View File

@@ -7,6 +7,7 @@ from odoo import models, fields, api, _
class HotelRoomAmenitiesType(models.Model):
_name = 'hotel.room.amenities.type'
_description = 'Amenities Type'
# The record's name
name = fields.Char('Amenity Name', required=True)
# Used for activate records

View File

@@ -10,8 +10,8 @@ class HotelRoomType(models.Model):
"""
_name = "hotel.room.type"
_description = "Room Type"
_inherits = {'product.product': 'product_id'}
# Relationship between models
product_id = fields.Many2one('product.product', 'Product Room Type',
required=True, delegate=True,
@@ -59,7 +59,7 @@ class HotelRoomType(models.Model):
@api.model
# TODO Rename to check_availability_room_type
def check_availability_virtual_room(self, dfrom, dto,
def check_availability_room(self, dfrom, dto,
room_type_id=False, notthis=[]):
"""
Check the avalability for an specific type of room

View File

@@ -10,7 +10,7 @@ class HotelRoomTypeAvailability(models.Model):
_inherit = 'mail.thread'
_name = 'hotel.room.type.availability'
# virtual_room_id = fields.Many2one('hotel.virtual.room', 'Virtual Room',
# room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room',
# required=True, track_visibility='always',
# ondelete='cascade')
room_type_id = fields.Many2one('hotel.room.type', 'Room Type',
@@ -34,7 +34,7 @@ class HotelRoomTypeAvailability(models.Model):
self.avail = 0
room_type_obj = self.env['hotel.room.type']
cavail = len(room_type_obj.check_availability_virtual_room(
cavail = len(room_type_obj.check_availability_room(
self.date,
self.date,
room_type_id=self.room_type_id.id))
@@ -44,7 +44,7 @@ class HotelRoomTypeAvailability(models.Model):
self.avail = max_avail
@api.constrains('date', 'room_type_id')
def _check_date_virtual_room_id(self):
def _check_date_room_type_id(self):
count = self.search_count([
('date', '=', self.date),
('room_type_id', '=', self.room_type_id.id)

View File

@@ -13,7 +13,7 @@ class HotelRoomTypeRestrictionItem(models.Model):
restriction_id = fields.Many2one('hotel.room.type.restriction',
'Restriction Plan', ondelete='cascade',
index=True)
# virtual_room_id = fields.Many2one('hotel.virtual.room', 'Virtual Room',
# room_type_id = fields.Many2one('hotel.virtual.room', 'Virtual Room',
# required=True, ondelete='cascade')
room_type_id = fields.Many2one('hotel.room.type', 'Room Type',
required=True, ondelete='cascade')
@@ -21,8 +21,8 @@ class HotelRoomTypeRestrictionItem(models.Model):
date_end = fields.Date("To")
applied_on = fields.Selection([
('1_global', 'Global'),
# ('0_virtual_room', 'Virtual Room')], string="Apply On", required=True,
# default='0_virtual_room',
# ('0_room_type', 'Virtual Room')], string="Apply On", required=True,
# default='0_room_type',
('0_room_type', 'Room Type')], string="Apply On", required=True,
default='0_room_type',
help='Pricelist Item applicable on selected option')

View File

@@ -8,7 +8,9 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
_logger = logging.getLogger(__name__)
class HotelService(models.Model):
_name = 'hotel.service'
_description = 'Hotel Services and its charges'
@api.model
def _service_checkin(self):
if 'checkin' in self._context:
@@ -30,9 +32,6 @@ class HotelService(models.Model):
], limit=1)
return False
_name = 'hotel.service'
_description = 'Hotel Services and its charges'
name = fields.Char('Service description')
# services in the hotel are products
product_id = fields.Many2one('product.product', 'Service', required=True)

View File

@@ -146,7 +146,7 @@ class HotelServiceLine(models.Model):
'product_uom': self.product_id.uom_id,
'price_unit': self.product_id.price,
})
self.write(write_vals)
self.update(write_vals)
#~ self.price_unit = tax_obj._fix_tax_included_price(prod.price,
#~ prod.taxes_id,

View File

@@ -7,7 +7,6 @@ _logger = logging.getLogger(__name__)
class AccountPayment(models.Model):
_inherit = 'account.payment'
folio_id = fields.Many2one('hotel.folio', string='Folio')

View File

@@ -20,12 +20,12 @@ access_hotel_order_call,hotel.order.call,sale.model_sale_order,hotel.group_hotel
access_hotel_order_line_call,hotel.order.line.call,sale.model_sale_order_line,hotel.group_hotel_call,1,1,1,1
access_hotel_order_line_user,hotel.order.line.user,sale.model_sale_order_line,hotel.group_hotel_user,1,1,1,1
access_hotel_order_user,hotel.order.user,sale.model_sale_order,hotel.group_hotel_user,1,1,1,1
access_hotel_restrictions_call,hotel.restriction. All,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_call,1,0,0,0
access_hotel_restrictions_item_call,hotel.restriction.item.call,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_call,1,0,0,0
access_hotel_restrictions_item_manager,hotel.restriction.item.manager,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_manager,1,1,1,1
access_hotel_restrictions_item_user,hotel.restriction.item.user,hotel.model_hotel_virtual_room_restriction_item,hotel.group_hotel_user,1,0,0,0
access_hotel_restrictions_manager,hotel.restriction.manager,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_manager,1,1,1,1
access_hotel_restrictions_user,hotel.restriction.user,hotel.model_hotel_virtual_room_restriction,hotel.group_hotel_user,1,0,0,0
access_hotel_restrictions_call,hotel.restriction. All,hotel.model_hotel_room_type_restriction,hotel.group_hotel_call,1,0,0,0
access_hotel_restrictions_item_call,hotel.restriction.item.call,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_call,1,0,0,0
access_hotel_restrictions_item_manager,hotel.restriction.item.manager,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_manager,1,1,1,1
access_hotel_restrictions_item_user,hotel.restriction.item.user,hotel.model_hotel_room_type_restriction_item,hotel.group_hotel_user,1,0,0,0
access_hotel_restrictions_manager,hotel.restriction.manager,hotel.model_hotel_room_type_restriction,hotel.group_hotel_manager,1,1,1,1
access_hotel_restrictions_user,hotel.restriction.user,hotel.model_hotel_room_type_restriction,hotel.group_hotel_user,1,0,0,0
access_hotel_room,hotel.room.user,model_hotel_room,hotel.group_hotel_user,1,0,0,0
access_hotel_room_amenities,hotel.room_aminities.user,model_hotel_room_amenities,hotel.group_hotel_user,1,0,0,0
access_hotel_room_amenities_call,hotel.room_aminities.call,model_hotel_room_amenities,hotel.group_hotel_call,1,0,0,0
@@ -43,9 +43,9 @@ access_hotel_service_call,hotel_service.call,model_hotel_service,hotel.group_hot
access_hotel_user reconcilie,hotel.user reconcilie,account.model_account_partial_reconcile,hotel.group_hotel_user,1,1,1,1
access_hotel_user_account_full_reconcilie,hotel.user_account_full_reconcilie,account.model_account_full_reconcile,hotel.group_hotel_user,1,1,1,1
access_hotel_user_user,hotel.user_res_user,auth_crypt.model_res_users,hotel.group_hotel_user,1,1,0,0
access_hotel_virtual_room_availability_call,hotel.availability.call,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_call,1,1,1,1
access_hotel_virtual_room_availability_manager,hotel.availability.manager,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_manager,1,1,1,1
access_hotel_virtual_room_availability_user,hotel.availability.user,hotel.model_hotel_virtual_room_availability,hotel.group_hotel_user,1,1,1,1
access_hotel_room_type_availability_call,hotel.availability.call,hotel.model_hotel_room_type_availability,hotel.group_hotel_call,1,1,1,1
access_hotel_room_type_availability_manager,hotel.availability.manager,hotel.model_hotel_room_type_availability,hotel.group_hotel_manager,1,1,1,1
access_hotel_room_type_availability_user,hotel.availability.user,hotel.model_hotel_room_type_availability,hotel.group_hotel_user,1,1,1,1
access_product_category,product.category.user,product.model_product_category,hotel.group_hotel_user,1,0,0,0
access_product_category_call,product.category.call,product.model_product_category,hotel.group_hotel_call,1,0,0,0
access_product_category_manager,product.category.manager,product.model_product_category,hotel.group_hotel_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
20 access_hotel_order_line_call hotel.order.line.call sale.model_sale_order_line hotel.group_hotel_call 1 1 1 1
21 access_hotel_order_line_user hotel.order.line.user sale.model_sale_order_line hotel.group_hotel_user 1 1 1 1
22 access_hotel_order_user hotel.order.user sale.model_sale_order hotel.group_hotel_user 1 1 1 1
23 access_hotel_restrictions_call hotel.restriction. All hotel.model_hotel_virtual_room_restriction hotel.model_hotel_room_type_restriction hotel.group_hotel_call 1 0 0 0
24 access_hotel_restrictions_item_call hotel.restriction.item.call hotel.model_hotel_virtual_room_restriction_item hotel.model_hotel_room_type_restriction_item hotel.group_hotel_call 1 0 0 0
25 access_hotel_restrictions_item_manager hotel.restriction.item.manager hotel.model_hotel_virtual_room_restriction_item hotel.model_hotel_room_type_restriction_item hotel.group_hotel_manager 1 1 1 1
26 access_hotel_restrictions_item_user hotel.restriction.item.user hotel.model_hotel_virtual_room_restriction_item hotel.model_hotel_room_type_restriction_item hotel.group_hotel_user 1 0 0 0
27 access_hotel_restrictions_manager hotel.restriction.manager hotel.model_hotel_virtual_room_restriction hotel.model_hotel_room_type_restriction hotel.group_hotel_manager 1 1 1 1
28 access_hotel_restrictions_user hotel.restriction.user hotel.model_hotel_virtual_room_restriction hotel.model_hotel_room_type_restriction hotel.group_hotel_user 1 0 0 0
29 access_hotel_room hotel.room.user model_hotel_room hotel.group_hotel_user 1 0 0 0
30 access_hotel_room_amenities hotel.room_aminities.user model_hotel_room_amenities hotel.group_hotel_user 1 0 0 0
31 access_hotel_room_amenities_call hotel.room_aminities.call model_hotel_room_amenities hotel.group_hotel_call 1 0 0 0
43 access_hotel_user reconcilie hotel.user reconcilie account.model_account_partial_reconcile hotel.group_hotel_user 1 1 1 1
44 access_hotel_user_account_full_reconcilie hotel.user_account_full_reconcilie account.model_account_full_reconcile hotel.group_hotel_user 1 1 1 1
45 access_hotel_user_user hotel.user_res_user auth_crypt.model_res_users hotel.group_hotel_user 1 1 0 0
46 access_hotel_virtual_room_availability_call access_hotel_room_type_availability_call hotel.availability.call hotel.model_hotel_virtual_room_availability hotel.model_hotel_room_type_availability hotel.group_hotel_call 1 1 1 1
47 access_hotel_virtual_room_availability_manager access_hotel_room_type_availability_manager hotel.availability.manager hotel.model_hotel_virtual_room_availability hotel.model_hotel_room_type_availability hotel.group_hotel_manager 1 1 1 1
48 access_hotel_virtual_room_availability_user access_hotel_room_type_availability_user hotel.availability.user hotel.model_hotel_virtual_room_availability hotel.model_hotel_room_type_availability hotel.group_hotel_user 1 1 1 1
49 access_product_category product.category.user product.model_product_category hotel.group_hotel_user 1 0 0 0
50 access_product_category_call product.category.call product.model_product_category hotel.group_hotel_call 1 0 0 0
51 access_product_category_manager product.category.manager product.model_product_category hotel.group_hotel_manager 1 1 1 1

View File

@@ -59,7 +59,7 @@ class TestHotel(TestMail):
'checkin': checkin.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'checkout': checkout.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
'folio_id': folio.id,
'virtual_room_id': room.price_virtual_room.id,
'room_type_id': room.price_room_type.id,
'product_id': room.product_id.id,
})
self.assertTrue(
@@ -171,14 +171,14 @@ class TestHotel(TestMail):
cls.hotel_room_simple_100 = Rooms.create({
'name': '100',
'sale_price_type': 'vroom',
'price_virtual_room': cls.hotel_vroom_budget.id,
'price_room_type': cls.hotel_vroom_budget.id,
'categ_id': cls.hotel_room_type_simple.cat_id.id,
'capacity': 1,
})
cls.hotel_room_simple_101 = Rooms.create({
'name': '101',
'sale_price_type': 'vroom',
'price_virtual_room': cls.hotel_vroom_budget.id,
'price_room_type': cls.hotel_vroom_budget.id,
'categ_id': cls.hotel_room_type_simple.cat_id.id,
'capacity': 1,
'sequence': 1,
@@ -186,7 +186,7 @@ class TestHotel(TestMail):
cls.hotel_room_double_200 = Rooms.create({
'name': '200',
'sale_price_type': 'vroom',
'price_virtual_room': cls.hotel_vroom_special.id,
'price_room_type': cls.hotel_vroom_special.id,
'categ_id': cls.hotel_room_type_double.cat_id.id,
'capacity': 2,
})
@@ -228,16 +228,16 @@ class TestHotel(TestMail):
for i in range(0, len(v_vr)):
ndate = now_utc_dt + timedelta(days=i)
vroom_avail_obj.create({
'virtual_room_id': k_vr,
'room_type_id': k_vr,
'avail': v_vr[i],
'date': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)
})
vroom_rest_item_obj.create({
'virtual_room_id': k_vr,
'room_type_id': k_vr,
'restriction_id': cls.parity_restrictions_id,
'date_start': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT),
'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT),
'applied_on': '0_virtual_room',
'applied_on': '0_room_type',
'min_stay': cls.restrictions_min_stay_tmp[k_vr][i],
})
pricelist_item_obj.create({

View File

@@ -232,7 +232,7 @@ class TestHotelReservations(TestHotel):
# 5.0, 15.0, 15.0, 35.0, 35.0, 10.0, 10.0
vroom_prices = self.prices_tmp[self.hotel_room_double_200.price_virtual_room.id]
vroom_prices = self.prices_tmp[self.hotel_room_double_200.price_room_type.id]
org_reserv_start_utc_dt = now_utc_dt + timedelta(days=1)
org_reserv_end_utc_dt = org_reserv_start_utc_dt + timedelta(days=2)
folio = self.create_folio(self.user_hotel_manager, self.partner_2)

View File

@@ -194,7 +194,7 @@
<field name="partner_id"/>
<field name="splitted" invisible="1" />
<field name="parent_reservation" invisible="1" />
<!-- <field name="virtual_room_id" string="Reserved Room Type"/> -->
<!-- <field name="room_type_id" string="Reserved Room Type"/> -->
<field name="room_type_id" string="Reserved Room Type"/>
<field name="nights" />
<field name="adults" string="Persons"/>
@@ -307,7 +307,7 @@
<field name="name"/>
<field name="adults"/>
<field name="children"/>
<!-- <field name="virtual_room_id" on_change="1" options="{'no_create': True,'no_open': True}"
<!-- <field name="room_type_id" on_change="1" options="{'no_create': True,'no_open': True}"
attrs="{'readonly':[('state','not in',('draft'))]}"/> -->
<field name="channel_type" attrs="{'required':[('reservation_type','not in',('staff','out'))]}"/>
</group>

View File

@@ -186,7 +186,7 @@
<field name="name"/>
<field name="adults"/>
<field name="children"/>
<!-- <field name="virtual_room_id" on_change="1" options="{'no_create': True,'no_open': True}"
<!-- <field name="room_type_id" on_change="1" options="{'no_create': True,'no_open': True}"
attrs="{'readonly':[('state','not in',('draft'))]}"/> -->
<field name="room_type_id" on_change="1" options="{'no_create': True,'no_open': True}"
attrs="{'readonly':[('state','not in',('draft'))]}"/>
@@ -335,7 +335,7 @@
/>
<field name="partner_id"/>
<field name="parent_reservation" invisible="1" />
<!-- <field name="virtual_room_id" string="Reserved Room Type"/> -->
<!-- <field name="room_type_id" string="Reserved Room Type"/> -->
<field name="room_type_id" string="Reserved Unit Type" />
<field name="nights" />
<field name="adults" string="Persons"/>
@@ -432,7 +432,7 @@
/>
<group expand="0" string="Group By">
<!-- <filter string="Room Type" domain="[]"
context="{'group_by':'virtual_room_id'}"/> -->
context="{'group_by':'room_type_id'}"/> -->
<filter string="Room Type" domain="[]"
context="{'group_by':'room_type_id'}"/>
<filter string="Creation Date" domain="[]"

View File

@@ -38,9 +38,9 @@
</group>
<group>
<!-- <field name="sale_price_type" /> -->
<!--field name="price_virtual_room_domain" invisible="1" /-->
<!-- <field name="price_virtual_room" domain="[('room_ids.id', '=', active_id)]" attrs="{'invisible':[('sale_price_type', '!=', 'vroom')], 'required': [('sale_price_type', '=', 'vroom')]}" /> -->
<!-- <field name="price_room_type" domain="[('room_ids.id', '=', active_id)]" attrs="{'invisible':[('sale_price_type', '!=', 'vroom')], 'required': [('sale_price_type', '=', 'vroom')]}" /> -->
<!--field name="price_room_type_domain" invisible="1" /-->
<!-- <field name="price_room_type" domain="[('room_ids.id', '=', active_id)]" attrs="{'invisible':[('sale_price_type', '!=', 'room_type')], 'required': [('sale_price_type', '=', 'room_type')]}" /> -->
<!-- <field name="price_room_type" domain="[('room_ids.id', '=', active_id)]" attrs="{'invisible':[('sale_price_type', '!=', 'room_type')], 'required': [('sale_price_type', '=', 'room_type')]}" /> -->
</group>
<newline />
<!-- <separator colspan='4' string="Customer Taxes" /> -->

View File

@@ -9,7 +9,7 @@
<form string="Restrictions">
<group>
<field name="applied_on" widget="radio"/>
<!-- <field name="virtual_room_id" attrs="{'invisible':[['applied_on', '=', '1_global']]}" required="True"/> -->
<!-- <field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_global']]}" required="True"/> -->
<field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_global']]}" required="True"/>
</group>
<group>
@@ -43,7 +43,7 @@
<field name="arch" type="xml">
<tree string="Restrictions">
<field name="applied_on"/>
<!-- <field name="virtual_room_id" attrs="{'invisible':[['applied_on', '=', '1_virtual_room']]}"/> -->
<!-- <field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '1_room_type']]}"/> -->
<field name="room_type_id" attrs="{'invisible':[['applied_on', '=', '0_room_type']]}"/>
<field name="date_start"/>
<field name="date_end"/>

View File

@@ -19,7 +19,7 @@
<field name="item_ids" nolabel="1">
<tree string="Restriction Items">
<field name="applied_on"/>
<!-- <field name="virtual_room_id" attr="{'invisible':[['applied_on', '=', '1_virtual_room']]}"/> -->
<!-- <field name="room_type_id" attr="{'invisible':[['applied_on', '=', '1_room_type']]}"/> -->
<field name="room_type_id" attr="{'invisible':[['applied_on', '=', '0_room_type']]}"/>
<field name="date_start"/>
<field name="date_end"/>

View File

@@ -2,14 +2,14 @@
<odoo>
<!-- FORM availability -->
<record id="virtual_room_availability_view_form" model="ir.ui.view">
<record id="room_type_availability_view_form" model="ir.ui.view">
<field name="name">hotel.room.type.availability.form</field>
<field name="model">hotel.room.type.availability</field>
<field name="arch" type="xml">
<form string="Availability">
<sheet>
<group>
<!-- <h1><field name="virtual_room_id" required="1"/></h1> -->
<!-- <h1><field name="room_type_id" required="1"/></h1> -->
<h1><field name="room_type_id" required="1"/></h1>
</group>
<group>
@@ -28,12 +28,12 @@
</record>
<!-- TREE restriction -->
<record id="virtual_room_availability_view_tree" model="ir.ui.view">
<record id="room_type_availability_view_tree" model="ir.ui.view">
<field name="name">hotel.room.type.availability.tree</field>
<field name="model">hotel.room.type.availability</field>
<field name="arch" type="xml">
<tree string="Restrictions">
<!-- <field name="virtual_room_id" required="1"/> -->
<!-- <field name="room_type_id" required="1"/> -->
<field name="room_type_id" required="1"/>
<field name="date" required="1"/>
<field name="avail"/>
@@ -44,7 +44,7 @@
</record>
<!-- Action of reservation restriction -->
<record model="ir.actions.act_window" id="virtual_room_availability_action">
<record model="ir.actions.act_window" id="room_type_availability_action">
<field name="name">Virtual Room Availability</field>
<field name="res_model">hotel.room.type.availability</field>
<field name="view_type">form</field>
@@ -52,8 +52,8 @@
</record>
<!-- MENUS -->
<menuitem name="Availability" id="virtual_room_availability_menu"
action="virtual_room_availability_action" sequence="22"
<menuitem name="Availability" id="room_type_availability_menu"
action="room_type_availability_action" sequence="22"
parent="hotel.configuration_others"/>
</odoo>

View File

@@ -2,9 +2,9 @@
<odoo>
<!-- FORM Virtual Room -->
<record id="virtual_room_view_form" model="ir.ui.view">
<field name="name">virtual.room.view.form</field>
<field name="model">hotel.virtual.room</field>
<record id="room_type_view_form" model="ir.ui.view">
<field name="name">room.type.view.form</field>
<field name="model">hotel.room.type</field>
<field name="arch" type="xml">
<form string="Virtual Room">
<sheet>
@@ -41,9 +41,9 @@
</record>
<!-- TREE Virtual Room -->
<record id="virtual_room_view_tree" model="ir.ui.view">
<field name="name">virtual.room.view.tree</field>
<field name="model">hotel.virtual.room</field>
<record id="room_type_view_tree" model="ir.ui.view">
<field name="name">room.type.view.tree</field>
<field name="model">hotel.room.type</field>
<field name="arch" type="xml">
<tree string="Virtual Rooms">
<field name="name"/>
@@ -57,16 +57,16 @@
</field>
</record>
<record model="ir.actions.act_window" id="virtual_room_action_form">
<record model="ir.actions.act_window" id="room_type_action_form">
<field name="name">Virtual Rooms</field>
<field name="res_model">hotel.virtual.room</field>
<field name="res_model">hotel.room.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- MENUS -->
<menuitem name="Virtual rooms" id="virtual_room_menu"
action="virtual_room_action_form" sequence="40"
<menuitem name="Virtual rooms" id="room_type_menu"
action="room_type_action_form" sequence="40"
parent="hotel.menu_hotel_room"/>
</odoo>

View File

@@ -212,7 +212,7 @@ class Wizard(models.TransientModel):
# show the checkin fields if a partner is selected
if self.op_select_partner == 'S' and self.partner_id.id != False:
write_vals.update({'checkin_mode': 1})
self.write(write_vals)
self.update(write_vals)
@api.onchange('op_select_partner')
def onchange_op_select_partner(self):

View File

@@ -32,7 +32,7 @@ class DuplicateReservationWizard(models.TransientModel):
}))
# Check Input
avails = hotel_room_type_obj.check_availability_virtual_room(
avails = hotel_room_type_obj.check_availability_room(
reservation_id.checkin,
reservation_id.checkout,
room_type_id=reservation_id.room_type_id.id)
@@ -43,10 +43,10 @@ class DuplicateReservationWizard(models.TransientModel):
There are no '%d' free rooms") % self.num)
for i in range(0, self.num):
free_rooms = hotel_room_type_obj.check_availability_virtual_room(
free_rooms = hotel_room_type_obj.check_availability_room(
reservation_id.checkin,
reservation_id.checkout,
virtual_room_id=reservation_id.room_type_id.id)
room_type_id=reservation_id.room_type_id.id)
if any(free_rooms):
new_reservation_id = hotel_reservation_obj.create({
'room_id': free_rooms[0].id,

View File

@@ -30,7 +30,7 @@ class MassiveChangesWizard(models.TransientModel):
('0', 'Global'),
('1', 'Virtual Room'),
], string='Applied On', default='0')
# virtual_room_ids = fields.Many2many('hotel.virtual.room',
# room_type_ids = fields.Many2many('hotel.virtual.room',
# string="Virtual Rooms")
room_type_ids = fields.Many2many('hotel.room.type',
string="Room Types")
@@ -171,7 +171,7 @@ class MassiveChangesWizard(models.TransientModel):
('date_start', '>=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)),
('date_end', '<=', ndate.strftime(DEFAULT_SERVER_DATE_FORMAT)),
('restriction_id', '=', record.restriction_id.id),
('applied_on', '=', '0_virtual_room'),
('applied_on', '=', '0_room_type'),
]
for room_type in room_types:
@@ -189,7 +189,7 @@ class MassiveChangesWizard(models.TransientModel):
'date_end': ndate.strftime(DEFAULT_SERVER_DATE_FORMAT),
'restriction_id': record.restriction_id.id,
'room_type_id': room_type.id,
'applied_on': '0_virtual_room',
'applied_on': '0_room_type',
})
hotel_room_type_re_it_obj.create(vals)
@@ -200,7 +200,7 @@ class MassiveChangesWizard(models.TransientModel):
if record.change_no_ota:
vals.update({'no_ota': record.no_ota})
if record.change_avail:
cavail = len(hotel_room_type_obj.check_availability_virtual_room(
cavail = len(hotel_room_type_obj.check_availability_room(
ndate.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
ndate.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
room_type_id=room_type.id))

View File

@@ -10,7 +10,7 @@
<group>
<field name="section" required="1" />
<field name="applied_on" required="1" />
<!-- <field name="virtual_room_ids" widget="many2many_tags" attrs="{'invisible':[('applied_on', '!=', '1')], 'required':[('applied_on', '=', '1')]}" /> -->
<!-- <field name="room_type_ids" widget="many2many_tags" attrs="{'invisible':[('applied_on', '!=', '1')], 'required':[('applied_on', '=', '1')]}" /> -->
<field name="room_type_ids" widget="many2many_tags" attrs="{'invisible':[('applied_on', '!=', '1')], 'required':[('applied_on', '=', '1')]}" />
</group>
<group colspan="8" col="8">

View File

@@ -64,7 +64,7 @@ class SplitReservationWizard(models.TransientModel):
'splitted': True,
'price_unit': tprice[1],
'parent_reservation': parent_res.id,
'virtual_room_id': parent_res.virtual_room_id.id,
'room_type_id': parent_res.room_type_id.id,
'discount': parent_res.discount,
})
reservation_copy = self.env['hotel.reservation'].create(vals)