From 8d8defe92d2aef8bcad633f6fd1552fd7327c466 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Thu, 25 Oct 2018 13:40:11 +0200 Subject: [PATCH] [ADD] Hotel Room Type Class basic structure: model, views and relations --- hotel/__manifest__.py | 1 + hotel/models/__init__.py | 1 + hotel/models/hotel_room_type.py | 3 +- hotel/models/hotel_room_type_class.py | 24 +++++++++++ hotel/views/hotel_room_type.xml | 1 + hotel/views/hotel_room_type_class.xml | 59 +++++++++++++++++++++++++++ 6 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 hotel/models/hotel_room_type_class.py create mode 100644 hotel/views/hotel_room_type_class.xml diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py index 06a070f6b..f5e6d59fb 100644 --- a/hotel/__manifest__.py +++ b/hotel/__manifest__.py @@ -43,6 +43,7 @@ # 'views/hotel_service_line.xml', 'views/hotel_room_type.xml', 'views/hotel_room.xml', + 'views/hotel_room_type_class.xml', # 'views/hotel_service.xml', 'views/inherit_product_product.xml', 'views/hotel_room_amenities_type.xml', diff --git a/hotel/models/__init__.py b/hotel/models/__init__.py index 6b4eea4f4..9afd2028c 100644 --- a/hotel/models/__init__.py +++ b/hotel/models/__init__.py @@ -30,4 +30,5 @@ from . import inherit_product_pricelist from . import res_config from . import inherit_res_partner from . import inherited_mail_compose_message +from . import hotel_room_type_class #~ from . import hotel_dashboard diff --git a/hotel/models/hotel_room_type.py b/hotel/models/hotel_room_type.py index 7dcd4abe0..5a2cdb122 100644 --- a/hotel/models/hotel_room_type.py +++ b/hotel/models/hotel_room_type.py @@ -5,7 +5,7 @@ from odoo import models, fields, api class HotelRoomType(models.Model): """ Before creating a 'room type', you need to consider the following: - With the term 'room type' is meant a type of residential accommodation: for + With the term 'room type' is meant a sales type of residential accommodation: for example, a Double Room, a Economic Room, an Apartment, a Tent, a Caravan... """ _name = "hotel.room.type" @@ -17,6 +17,7 @@ class HotelRoomType(models.Model): required=True, delegate=True, ondelete='cascade') room_ids = fields.One2many('hotel.room', 'room_type_id', 'Rooms') + class_id = fields.Many2one('hotel.room.type.class', 'Hotel Type Class') # TODO Hierarchical relationship for parent-child tree ? # parent_id = fields.Many2one ... diff --git a/hotel/models/hotel_room_type_class.py b/hotel/models/hotel_room_type_class.py new file mode 100644 index 000000000..281158a58 --- /dev/null +++ b/hotel/models/hotel_room_type_class.py @@ -0,0 +1,24 @@ +# Copyright 2017 Alexandre Díaz +# Copyright 2017 Dario Lodeiros +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields, api + +class HotelRoomTypeClass(models.Model): + """ Before creating a 'room type_class', you need to consider the following: + With the term 'room type class' is meant a physicial class of + residential accommodation: for example, a Room, a Bed, an Apartment, + a Tent, a Caravan... + """ + _name = "hotel.room.type.class" + _description = "Room Type Class" + _order = "sequence, code_class, name" + _sql_constraints = [('code_type_unique', 'unique(code_type)', + 'code must be unique!')] + + name = fields.Char('Class Name', required=True, translate=True) + room_type_ids = fields.One2many('hotel.room.type', 'class_id', 'Types') + active = fields.Boolean('Active', default=True, + help="The active field allows you to hide the \ + category without removing it.") + sequence = fields.Integer('Sequence', default=0) + code_class = fields.Char('Code') diff --git a/hotel/views/hotel_room_type.xml b/hotel/views/hotel_room_type.xml index 6bb542463..fdaeb9b8d 100644 --- a/hotel/views/hotel_room_type.xml +++ b/hotel/views/hotel_room_type.xml @@ -22,6 +22,7 @@ + diff --git a/hotel/views/hotel_room_type_class.xml b/hotel/views/hotel_room_type_class.xml new file mode 100644 index 000000000..4414b4f04 --- /dev/null +++ b/hotel/views/hotel_room_type_class.xml @@ -0,0 +1,59 @@ + + + + + + hotel.room.type.class.form + hotel.room.type.class + +
+ +
+ +
+ + + + + + + + + + + +
+
+
+
+ + + + hotel.room.type.class.tree + hotel.room.type.class + + + + + + + + + + + + + Room Type Class + hotel.room.type.class + form + tree,form + + + +