diff --git a/hotel/models/__init__.py b/hotel/models/__init__.py
index 84c6f0088..29689f309 100644
--- a/hotel/models/__init__.py
+++ b/hotel/models/__init__.py
@@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import inherited_payment_return
+from . import hotel_board_service_room_type
from . import hotel_floor
from . import hotel_folio
from . import hotel_reservation
diff --git a/hotel/models/hotel_board_service_room_type.py b/hotel/models/hotel_board_service_room_type.py
new file mode 100644
index 000000000..ec9111d22
--- /dev/null
+++ b/hotel/models/hotel_board_service_room_type.py
@@ -0,0 +1,56 @@
+# Copyright 2017 Dario Lodeiros
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from odoo import api, fields, models, _
+from odoo.addons import decimal_precision as dp
+from odoo.exceptions import UserError
+
+
+class HotelBoardServiceRoomType(models.Model):
+ _name = 'hotel.board.service.room.type'
+ _table = 'hotel_board_service_room_type_rel'
+ _rec_name = 'hotel_board_service_id'
+ _log_access = False
+ _description = 'Board Service included in Room'
+
+ hotel_board_service_id = fields.Many2one(
+ 'hotel.board.service', 'Board Service', index=True, ondelete='cascade', required=True)
+ hotel_room_type_id = fields.Many2one(
+ 'hotel.room.type', 'Room Type', index=True, ondelete='cascade', required=True)
+ pricelist_id = fields.Many2one(
+ 'product.pricelist', 'Pricelist', required=False)
+ price_type = fields.Selection([
+ ('fixed','Fixed'),
+ ('percent','Percent')], string='Type', default='fixed', required=True)
+ amount = fields.Float('Amount', digits=dp.get_precision('Product Price'), default=0.0)
+
+ @api.model_cr
+ def init(self):
+ self._cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('hotel_board_service_id_hotel_room_type_id_pricelist_id',))
+ if not self._cr.fetchone():
+ self._cr.execute('CREATE INDEX hotel_board_service_id_hotel_room_type_id_pricelist_id ON hotel_board_service_room_type_rel (hotel_board_service_id, hotel_room_type_id, pricelist_id)')
+
+ @api.constrains('pricelist_id')
+ def constrains_pricelist_id(self):
+ for record in self:
+ if self.pricelist_id:
+ board_pricelist = self.env['hotel.board.service.room.type'].search([
+ ('pricelist_id','=', record.pricelist_id.id),
+ ('hotel_room_type_id','=', record.hotel_room_type_id.id),
+ ('hotel_board_service_id','=',record.hotel_board_service_id.id),
+ ('id','!=',record.id)
+ ])
+ if board_pricelist:
+ raise UserError(
+ _("This Board Service in this Room can't repeat pricelist"))
+ else:
+ board_pricelist = self.env['hotel.board.service.room.type'].search([
+ ('pricelist_id','=', False),
+ ('hotel_room_type_id','=', record.hotel_room_type_id.id),
+ ('hotel_board_service_id','=',record.hotel_board_service_id.id),
+ ('id','!=',record.id)
+ ])
+ if board_pricelist:
+ raise UserError(
+ _("This Board Service in this Room can't repeat without pricelist"))
+
+
diff --git a/hotel/models/hotel_room_type.py b/hotel/models/hotel_room_type.py
index 606b0e1c9..f2f369c28 100644
--- a/hotel/models/hotel_room_type.py
+++ b/hotel/models/hotel_room_type.py
@@ -19,6 +19,8 @@ class HotelRoomType(models.Model):
ondelete='cascade')
room_ids = fields.One2many('hotel.room', 'room_type_id', 'Rooms')
class_id = fields.Many2one('hotel.room.type.class', 'Hotel Type Class')
+ board_service_room_type_ids = fields.One2many(
+ 'hotel.board.service.room.type', 'hotel_room_type_id', string='Board Services')
room_amenity_ids = fields.Many2many('hotel.amenity',
'hotel_room_type_aminity_rel',
'room_type_ids', 'amenity_ids',
diff --git a/hotel/security/ir.model.access.csv b/hotel/security/ir.model.access.csv
index 182f2df76..7484025a9 100644
--- a/hotel/security/ir.model.access.csv
+++ b/hotel/security/ir.model.access.csv
@@ -16,3 +16,4 @@ access_hotel_room_type_restriction_item,access_hotel_room_type_restriction_item,
access_hotel_reservation,access_hotel_reservation,model_hotel_reservation,base.group_user,1,0,0,0
access_hotel_folio,access_hotel_folio,model_hotel_folio,base.group_user,1,0,0,0
access_hotel_room_type,access_hotel_room_type,model_hotel_room_type,base.group_user,1,0,0,0
+access_hotel_board_service_room_type,access_hotel_board_service_room_type,model_hotel_board_service_room_type,base.group_user,1,0,0,0
diff --git a/hotel/security/ir.model.access.csv.old b/hotel/security/ir.model.access.csv.old
deleted file mode 100644
index 73c9ce80a..000000000
--- a/hotel/security/ir.model.access.csv.old
+++ /dev/null
@@ -1,54 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_currency_exchange_call,hotel.currency_exchange.call,model_currency_exchange,hotel.group_hotel_call,1,1,1,1
-access_currency_exchange_user,hotel.currency_exchange.user,model_currency_exchange,hotel.group_hotel_user,1,1,1,1
-access_folio_room_line_call,hotel.folio_room_line.call,hotel.model_hotel_reservation_line,hotel.group_hotel_call,1,1,1,1
-access_folio_room_line_user,hotel.folio_room_line.user,hotel.model_hotel_reservation_line,hotel.group_hotel_user,1,1,1,1
-access_hotel_account_tax_call,hotel.account.tax.call,account.model_account_tax,hotel.group_hotel_call,1,1,1,1
-access_hotel_account_tax_user,hotel.account.tax.user,account.model_account_tax,hotel.group_hotel_user,1,1,1,1
-access_hotel_floor_group,hotel.floor.user,model_hotel_floor,hotel.group_hotel_user,1,0,0,0
-access_hotel_floor_group_call,hotel.floor.call,model_hotel_floor,hotel.group_hotel_call,1,0,0,0
-access_hotel_floor_group_manager,hotel.floor.manager,model_hotel_floor,hotel.group_hotel_manager,1,1,1,1
-access_hotel_folio,hotel.folio.user,model_hotel_folio,hotel.group_hotel_user,1,1,1,1
-access_hotel_folio_call,hotel.folio.call,model_hotel_folio,hotel.group_hotel_call,1,1,1,1
-access_hotel_folio_line,hotel_folio.line.user,model_hotel_reservation,hotel.group_hotel_user,1,1,1,1
-access_hotel_folio_line_call,hotel_folio.line.call,model_hotel_reservation,hotel.group_hotel_call,1,1,1,1
-access_hotel_invoice_call,account.invoice.call,account.model_account_invoice,hotel.group_hotel_call,1,1,1,1
-access_hotel_invoice_user,account.invoice.user,account.model_account_invoice,hotel.group_hotel_user,1,1,1,1
-access_hotel_model_checkin_partner_call,hotel.currency_exchange.call,hotel.model_checkin_partner,hotel.group_hotel_call,1,1,1,1
-access_hotel_model_checkin_partner_user,hotel.currency_exchange.user,hotel.model_checkin_partner,hotel.group_hotel_user,1,1,1,1
-access_hotel_order_call,hotel.order.call,sale.model_sale_order,hotel.group_hotel_call,1,1,1,1
-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_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
-access_hotel_room_amenities_manager,hotel.room_aminities.manager,model_hotel_room_amenities,hotel.group_hotel_manager,1,1,1,1
-access_hotel_room_amenities_type,hotel.room_amenities_type.user,model_hotel_room_amenities_type,hotel.group_hotel_user,1,0,0,0
-access_hotel_room_amenities_type_call,hotel.room_amenities_type.call,model_hotel_room_amenities_type,hotel.group_hotel_call,1,0,0,0
-access_hotel_room_amenities_type_manager,hotel.room_amenities_type.manager,model_hotel_room_amenities_type,hotel.group_hotel_manager,1,1,1,1
-access_hotel_room_call,hotel.room.call,model_hotel_room,hotel.group_hotel_call,1,0,0,0
-access_hotel_room_manager,hotel.room.manager,model_hotel_room,hotel.group_hotel_manager,1,1,1,1
-access_hotel_room_type,hotel.room_type.user,model_hotel_room_type,hotel.group_hotel_user,1,0,0,0
-access_hotel_room_type_call,hotel.room_type.call,model_hotel_room_type,hotel.group_hotel_call,1,0,0,0
-access_hotel_room_type_manager,hotel.room_type.manager,model_hotel_room_type,hotel.group_hotel_manager,1,1,1,1
-access_hotel_service,hotel_service.user,model_hotel_service,hotel.group_hotel_user,1,1,1,1
-access_hotel_service_call,hotel_service.call,model_hotel_service,hotel.group_hotel_call,1,1,1,1
-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_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
-access_product_product,product.product.user,product.model_product_product,hotel.group_hotel_user,1,0,0,0
-access_product_product_call,product.product.call,product.model_product_product,hotel.group_hotel_call,1,0,0,0
-access_product_product_manager,product.product.manager,product.model_product_product,hotel.group_hotel_manager,1,1,1,1
diff --git a/hotel/views/hotel_room_type_views.xml b/hotel/views/hotel_room_type_views.xml
index b31b0be9d..7816a72a8 100644
--- a/hotel/views/hotel_room_type_views.xml
+++ b/hotel/views/hotel_room_type_views.xml
@@ -36,6 +36,19 @@
+
+
+
+
+
+
+
+
+
+
+
+