Merge branch '11.0' of https://github.com/hootel/hootel into 11.0

This commit is contained in:
Dario Lodeiros
2019-03-19 13:37:53 +01:00
18 changed files with 652 additions and 3 deletions

View File

@@ -169,10 +169,13 @@ class HotelReservationImporter(Component):
'room_type_id': room_type_bind.odoo_id.id,
'splitted': split_booking,
'name': room_type_bind and room_type_bind.name,
'board_service_room_id': room_type_bind.board_service_room_type_ids.filtered(
lambda r: r.channel_service == book['boards'][room_type_bind.external_id]).id or None,
'channel_bind_ids': [(0, False, binding_vals)],
}
if book['id_channel'] == 0:
# Information about boards: only for wubook reservations
vals.update({'board_service_room_id': room_type_bind.board_service_room_type_ids.filtered(
lambda r: r.channel_service == book['boards'][room_type_bind.external_id]).id or None})
return vals
@api.model
@@ -254,7 +257,6 @@ class HotelReservationImporter(Component):
def _generate_reservations(self, bookings):
_logger.info("==[CHANNEL->ODOO]==== READING BOOKING ==")
_logger.info(bookings)
# Get user timezone
res_partner_obj = self.env['res.partner']
channel_reserv_obj = self.env['channel.hotel.reservation']

View File

@@ -0,0 +1,13 @@
KELLYS DAILY REPORT
=============
Export PDF KELLYS REPORT
Credits
=======
Creator
------------
* Jose Luis Algara Toledo <osotranquilo@gmail.com>

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import models
from . import wizard

View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2018 Jose Luis Algara Toledo <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Hotel Kellys Daily Report',
'version': '2.1',
'author': "Jose Luis Algara Toledo <osotranquilo@gmail.com>",
'website': 'https://www.aldahotels.com',
'category': 'hotel report kellys',
'summary': "Export daily report in PDF format",
'description': "Kellys Daily Report",
'depends': [
'hotel',
],
'data': [
'data/report_kellys_paperformat.xml',
'views/kellysnames.xml',
'wizard/kellys_daily_rooms.xml',
'wizard/kellys_daily_pdf.xml',
'data/menus.xml',
'report/report_kellys.xml',
'security/ir.model.access.csv',
],
'qweb': [],
'test': [
],
'css': ['static/src/css/kellys_daily_report.css'],
'installable': True,
'auto_install': False,
'application': False,
'license': 'AGPL-3',
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem
id="menu_hotel_kellys_report"
name="Listado limpieza habitaciones"
parent="hotel.hotel_reports_menu"
action="report_kellys_act"
groups="hotel.group_hotel_user,hotel.group_hotel_manager"
sequence="25"
/>
</data>
</odoo>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="report_kellys_paperformat" model="report.paperformat">
<field name="name">Kellys report</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">360</field>
<field name="page_width">60</field>
<field name="orientation">Portrait</field>
<field name="margin_top">1</field>
<field name="margin_bottom">3</field>
<field name="margin_left">0</field>
<field name="margin_right">0</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">1</field>
<field name="dpi">201</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Alda Hotels <informatica@aldahotels.com>
# Jose Luis Algara <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import kellysnames

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alda Hotels <informatica@aldahotels.com>
# Jose Luis Algara <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api
class KellysNames(models.Model):
_name = 'kellysnames'
name = fields.Char('Limpiador/a')

View File

@@ -0,0 +1,194 @@
<?xml version="1.0"?>
<odoo>
<report id="report_kellysrooms" string="Reporte kellysrooms" model="kellysrooms" report_type="qweb-pdf" name="kellys_daily_report.template_kellysrooms" file="kellys_daily_report.template_kellysrooms" paperformat="report_kellys_paperformat"/>
<template id="template_kellysrooms_css">
<style>
.titulo {
font-size: 4.2em;
text-align: center;
}
.marco {
border-radius: 47px 10px 10px 10px;
-moz-border-radius: 47px 10px 10px 10px;
-webkit-border-radius: 47px 10px 10px 10px;
border: 3px solid #000000;
padding: 10px 3px;
margin: 3px 0;
text-align: center;
}
.client {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border: 1px solid #000000;
color: #000000;
background-color: #FFFFFF;
}
.exit {
border-radius: 20px 47px 47px 10px;
-moz-border-radius: 20px 47px 47px 10px;
-webkit-border-radius: 20px 47px 47px 10px;
border: 2px solid #000000;
padding: 20px 0;
color: #000000;
background-color: #FFFFFF;
}
.revise {
padding: 20px 0;
color: #000000;
background-color: #FFFFFF;
}
.pie {
font-size: 0.95em;
margin: 2em 0 4em 0;
}
.tipo {
font-size: 3.2em;
font-weight: bold;
}
.notas {
width: 90% !important;
margin: 3px 4px;
color: #000000;
text-align: left;
font-size: 2em;
}
.habitacion {
font-size: 3.2em;
padding: 0 0 0 3px;
}
.datos {
font-size: 2.4em;
}
.section {
clear: both;
padding: 0;
margin: 3px 0;
}
/* COLUMN SETUP */
.col {
display: block;
float: left;
margin: 1% 0 1% 1.6%;
}
.col:first-child {
margin-left: 0;
}
/* GROUPING */
.group:after,
.group:before {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
/* For IE 6/7 */
}
/* GRID OF TWO */
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.2%;
}
</style>
</template>
<template id="template_kellysrooms">
<t t-call="web.basic_layout">
<div class="page">
<t t-call="kellys_daily_report.template_kellysrooms_css"/>
<t t-set="actualkelly" t-value="False"/>
<t t-set="espie" t-value="False"/>
<t t-set="totalkelly" t-value="0"/>
<t t-foreach="docs" t-as="o">
<t t-if="actualkelly != o.kelly">
<t t-if="o_index != 0">
<t t-set="espie" t-value="True"/>
</t>
<t t-set="actualkelly" t-value="o.kelly"/>
<t t-if="espie == True">
<t t-set="espie" t-value="False"/>
<div class="pie">Impreso el
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d-%m-%Y a las %H:%M')"/>
Habitaciones:
<t t-esc="totalkelly"/></div>
<t t-set="totalkelly" t-value="0"/>
<p style="page-break-before:always;"></p>
</t>
<div class="marco" align="center">
<div class="titulo" align="center"><span t-field="o.kelly"/><br/>
Habitaciones<br/>
<span t-field="o.clean_date" t-options='{"format": "d MMMM Y"}'/>
</div>
</div>
</t>
<div t-if="o.tipo == 1" class="exit section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">SALIDA</div>
<t t-if="o.checkin != ''">
<div class="datos col span_2_of_2">Entrada
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/></div>
</t>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 2" class="client section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">CLIENTE</div>
<div class="datos col span_2_of_2">Del
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 3" class="revise section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">REVISAR</div>
<div class="datos col span_2_of_2">Entrada
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 4" class="client section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">STAFF</div>
<div class="datos col span_2_of_2">Del
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
</t>
<div class="pie">Impreso el
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d-%m-%Y a las %H:%M')"/>
Habitaciones:
<t t-esc="totalkelly"/></div>
</div>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_kellys.model_category_manager,access_kellys.manager,kellys_daily_report.model_kellysnames,hotel.group_hotel_manager,1,1,1,1
access_kellys.model_category_call,access_kellys.call,kellys_daily_report.model_kellysnames,hotel.group_hotel_call,0,0,0,0
access_kellys.model_category_user,access_kellys.user,kellys_daily_report.model_kellysnames,hotel.group_hotel_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_kellys.model_category_manager access_kellys.manager kellys_daily_report.model_kellysnames hotel.group_hotel_manager 1 1 1 1
3 access_kellys.model_category_call access_kellys.call kellys_daily_report.model_kellysnames hotel.group_hotel_call 0 0 0 0
4 access_kellys.model_category_user access_kellys.user kellys_daily_report.model_kellysnames hotel.group_hotel_user 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -0,0 +1 @@
.o_datepicker {max-width: 9.5em}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="tree_kellysnames" model="ir.ui.view">
<field name="model">kellysnames</field>
<field name="name">kellysnames.tree.view</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
</tree>
</field>
</record>
<act_window id="names_kellys_act" name="Kellys Names" res_model="kellysnames" view_mode="tree,form"/>
<menuitem id="menu_hotel_kellys_names" name="Personal de limieza" parent="hotel.menu_hotel_room" action="names_kellys_act" groups="hotel.group_hotel_user,hotel.group_hotel_manager" sequence="45"/>
</data>
</odoo>

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import kellys_daily_pdf
from . import kellys_daily_rooms

View File

@@ -0,0 +1,151 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2018 Jose Luis Algara Toledo <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
from datetime import datetime, date, time
from odoo import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
# from odoo.tools import report
class KellysWizard(models.TransientModel):
_name = 'kellysreport'
@api.model
def _get_default_habitaciones(self):
return self.calculalimpiar(datetime.now())
date_start = fields.Date("Fecha del listado", default=datetime.now())
habitaciones = fields.Many2many('kellysrooms', string="Limpieza:",
default=_get_default_habitaciones)
order = fields.Selection([
('kelly ASC', 'Calendario'),
('kelly ASC, tipo ASC', 'Limpiar como... y orden en el Calendario'),
('kelly ASC, tipo ASC, checkin ASC',
'Limpiar como... y Hora de entrada'),
], 'Orden de impresión',
default='kelly ASC, tipo ASC, checkin ASC',
required=True,
help='Establece el orden en el que se imprimira el listado')
@api.multi
def calculate_report(self):
self.habitaciones = self.calculalimpiar(
datetime.strptime(self.date_start, "%Y-%m-%d"))
return
@api.multi
def calculalimpiar(self, fechalimpieza=datetime.now()):
dates = datetime.strftime(fechalimpieza, "%Y-%m-%d")
grids = self.env['hotel.room'].search([], order='sequence ASC')
grids2 = self.env['kellysrooms']
listid = []
for x in grids:
rooms = self.env['hotel.reservation'].search(
['&', '&', ('checkin', '<=', dates),
('checkout', '>=', dates),
('state', '<>', 'cancelled'),
('room_id', '=', x.id)
], order='checkin ASC')
tipos = False
if len(rooms) != 0:
if len(rooms) == 2:
tipos = 1
# Salida y etrada
checkinhour = rooms[1].checkin
checkouthour = rooms[1].checkout[:10]
else:
if rooms[0].checkin[:10] == dates:
checkinhour = rooms[0].checkin
checkouthour = rooms[0].checkout[:10]
tipos = 3
# Revisar
elif rooms[0].checkout[:10] == dates:
checkinhour = 'no prevista'
checkouthour = ''
tipos = 1
# Salida
else:
checkinhour = rooms[0].checkin[:10]
checkouthour = rooms[0].checkout[:10]
tipos = 2
# Cliente
if rooms[0].reservation_type == 'staff':
checkinhour = rooms[0].checkin[:10]
checkouthour = rooms[0].checkout[:10]
tipos = 4
# Staff
if rooms[0].reservation_type == 'out':
checkinhour = rooms[0].checkin[:10]
checkouthour = rooms[0].checkout[:10]
tipos = 5
# Averiada
if tipos is not False:
listid.append(grids2.create(
{'habitacion': rooms[0].room_id.name,
'habitacionid': rooms[0].room_id.id,
'tipo': tipos,
'notas': '',
'checkin': checkinhour,
# 'checkin': rooms[0].checkin[:10],
# 'checkout': rooms[0].checkout[:10],
'checkout': checkouthour,
# 'kelly': 5,
'clean_date': fechalimpieza
}).id)
return self.env['kellysrooms'].search([('id', 'in', listid)])
# class ParticularReport(models.AbstractModel):
# _name = 'report.module.report_name'
# @api.model
# def render_html(self, docids, data=None):
# report_obj = self.env['report']
# report = report_obj._get_report_from_name('module.report_name')
# docargs = {
# 'doc_ids': docids,
# 'doc_model': report.model,
# 'docs': self,
# }
# return report_obj.render('module.report_name', docargs)
@api.multi
def print_rooms_report(self):
rooms = self.env['kellysrooms'].search([('id', 'in',
self.habitaciones.ids)],
order=self.order)
docargs = {
'doc_ids': rooms.ids,
'doc_model': 'kellysrooms',
'docs': self,
}
# Debug Stop -------------------
#import wdb; wdb.set_trace()
# Debug Stop -------------------
# return self.env['report'].get_action(rooms, 'action_report_kellys')
# return self.env['report'].get_action(rooms, 'report_action_kellysrooms')
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(self, rooms)
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(self, docargs)
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(rooms, docargs)
return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(rooms)
# return {'type': 'ir.actions.report','report_kellysrooms': 'kellys_daily_report.template_kellysrooms','report_type':"qweb-pdf",'data': rooms,}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" ?>
<odoo>
<data>
<act_window id="report_kellys_act" name="Kellys Daily Report Wizard" res_model="kellysreport" view_mode="form"/>
<record model="ir.ui.view" id="kellys_report_view">
<field name="name">kellys_daily_report_view</field>
<field name="model">kellysreport</field>
<field name="arch" type="xml">
<form string="kellys Daily Report">
<sheet>
<group string="Generar PDF de limpieza a fecha:">
<field name="date_start"/>
<button name="calculate_report" string="Recalcular" type="object" class="oe_highlight"/>
</group>
<group colspan="4">
<field name="habitaciones"/>
</group>
<group colspan="2">
<field name="order"/>
</group>
<footer>
<button type="object" class="oe_highlight" icon="fa-file-pdf-o" name="print_rooms_report" string="Print in PDF"/>
</footer>
</sheet>
</form>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2019 Jose Luis Algara Toledo <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import fields, models
class KellysRooms(models.TransientModel):
_name = 'kellysrooms'
habitacion = fields.Char('Habitacion')
habitacionid = fields.Integer('Habitacion ID')
tipo = fields.Selection([(1, 'Salida'), (2, 'Cliente'), (3, 'Revisar'),
(4, 'Staff'), (5, 'Averia')],
string='Limpiar como')
notas = fields.Char('Notas limpieza')
checkin = fields.Char('Entrada')
checkout = fields.Char('Salida')
kelly = fields.Many2one('kellysnames', string='Asignado a:')
clean_date = fields.Date('Clean Date')

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<odoo>
<data>
<record model="ir.ui.view" id="tree_kellysrooms">
<field name="name">kellysrooms.tree.view</field>
<field name="model">kellysrooms</field>
<field name="arch" type="xml">
<tree decoration-danger="tipo == 1" decoration-success="tipo == 2" decoration-info="tipo == 3" decoration-warning="tipo == 4" decoration-muted="tipo == 5" editable="top" create="false" string="Kellys Rooms">
<field name="habitacion" readonly="1"/>
<field name="tipo"/>
<field name="notas"/>
<field name="checkin" readonly="1"/>
<field name="checkout" readonly="1"/>
<field name="kelly"/>
</tree>
</field>
</record>
</data>
</odoo>