[ADD] Hotel Room Closure Reasons

This commit is contained in:
Dario Lodeiros
2018-10-25 20:26:41 +02:00
parent e7e76d1b3e
commit 544b82d022
8 changed files with 70 additions and 3 deletions

View File

@@ -51,6 +51,7 @@
'views/hotel_room_type_restriction_views.xml',
'views/hotel_room_type_restriction_item_views.xml',
'views/hotel_reservation.xml',
'views/room_closure_reason.xml',
# 'views/room_type_views.xml',
'views/cardex.xml',
'views/hotel_room_type_availability.xml',

View File

@@ -31,4 +31,5 @@ from . import res_config
from . import inherit_res_partner
from . import inherited_mail_compose_message
from . import hotel_room_type_class
from . import room_closure_reason
#~ from . import hotel_dashboard

View File

@@ -48,6 +48,7 @@ class HotelFolio(models.Model):
default=lambda self: _('New'))
partner_id = fields.Many2one('res.partner',
track_visibility='onchange')
closure_reason_id = fields.Many2one('room.closure.reason')
# partner_invoice_id = fields.Many2one('res.partner',
# string='Invoice Address',
# readonly=True, required=True,

View File

@@ -159,6 +159,7 @@ class HotelReservation(models.Model):
required=True, track_visibility='onchange')
partner_id = fields.Many2one(related='folio_id.partner_id')
closure_reason_id = fields.Many2one(related='folio_id.closure_reason_id')
company_id = fields.Many2one('res.company', 'Company')
reservation_line_ids = fields.One2many('hotel.reservation.line',
'reservation_id',

View File

@@ -0,0 +1,11 @@
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
class RoomClosureReason(models.Model):
_name = "room.closure.reason"
_description = "Cause of out of service"
name = fields.Char('Name', required=True)
description = fields.Text('Description')

View File

@@ -124,7 +124,8 @@
<!-- <field name="image" widget="image" class="oe_avatar" options="{&quot;preview_image&quot;: &quot;image_medium&quot;, &quot;size&quot;: [90, 90]}"/> -->
<h2><field name="name"/></h2>
<h1>
<field name="partner_id" default_focus="1" placeholder="Guest"/>
<field name="partner_id" default_focus="1" placeholder="Guest" attrs="{'invisible':[('reservation_type','in',('out'))]}"/>
<field name="closure_reason_id" placeholder="Closure reason" default_focus="1" attrs="{'invisible':[('reservation_type','not in',('out'))]}"/>
</h1>
<group>
<group>

View File

@@ -161,9 +161,19 @@
style="margin-right: 30px;" required='1'/>
<field name="partner_id" default_focus="1"
placeholder="Lastname, Firstname"
attrs="{'readonly':[('folio_id','!=',False)]}"
attrs="{'readonly':[('folio_id','!=',False)],
'invisible':[('reservation_type','in',('out'))]}"
required="1"/>
<span class="fa fa-user" style="margin-left:20px;"/>
<field name="closure_reason_id" default_focus="1"
options="{'no_create': True,'no_open': True}"
placeholder="Closure Reason"
attrs="{'readonly':[('folio_id','!=',False)],
'invisible':[('reservation_type','not in',('out'))]}"
required="1"/>
<span class="fa fa-user" style="margin-left:20px;"
attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
<span class="fa fa-ban" style="margin-left:20px;"
attrs="{'invisible': [('reservation_type','not in',('out'))]}"/>
</h1>
<h3>
From <span class="fa fa-sign-in" style="margin: 5px;"/>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form view of hotel room type class-->
<record model="ir.ui.view" id="view_hotel_room_closure_reason_form">
<field name="name">hotel.room.closure.reason.form</field>
<field name="model">room.closure.reason</field>
<field name="arch" type="xml">
<form string="Hotel Room Closure Reason">
<sheet>
<field name="name" />
<field name="description" />
</sheet>
</form>
</field>
</record>
<!-- Tree view of hotel room type class -->
<record model="ir.ui.view" id="view_hotel_room_closure_reason_tree">
<field name="name">>hotel.room.closure.reason.tree</field>
<field name="model">room.closure.reason</field>
<field name="arch" type="xml">
<tree string="Hotel Room Closure Reason">
<field name="name"/>
<field name="description" />
</tree>
</field>
</record>
<!-- Action for hotel room type class -->
<record model="ir.actions.act_window" id="open_hotel_room_closure_reason_form_tree">
<field name="name">Room Closure Reason</field>
<field name="res_model">room.closure.reason</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Closure Reasons" id="menu_hotel_room_closure_reason_form_tree"
action="open_hotel_room_closure_reason_form_tree" sequence="25"
parent="hotel.configuration_others" />
</odoo>