diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index 002742396..cfa17d5ae 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -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'] diff --git a/kellys_daily_report/README.rst b/kellys_daily_report/README.rst new file mode 100644 index 000000000..7bf0177f1 --- /dev/null +++ b/kellys_daily_report/README.rst @@ -0,0 +1,13 @@ +KELLYS DAILY REPORT +============= + +Export PDF KELLYS REPORT + + +Credits +======= + +Creator +------------ + +* Jose Luis Algara Toledo diff --git a/kellys_daily_report/__init__.py b/kellys_daily_report/__init__.py new file mode 100644 index 000000000..e73c9c829 --- /dev/null +++ b/kellys_daily_report/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2018 Alexandre Díaz +# +# 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 . +# +############################################################################## +from . import models +from . import wizard diff --git a/kellys_daily_report/__manifest__.py b/kellys_daily_report/__manifest__.py new file mode 100644 index 000000000..1bb6cf00a --- /dev/null +++ b/kellys_daily_report/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# Copyright (C) 2018 Jose Luis Algara Toledo +# +# 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 . +# +############################################################################## + +{ + 'name': 'Hotel Kellys Daily Report', + 'version': '2.1', + 'author': "Jose Luis Algara Toledo ", + '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', +} diff --git a/kellys_daily_report/data/menus.xml b/kellys_daily_report/data/menus.xml new file mode 100644 index 000000000..0bf4c2c43 --- /dev/null +++ b/kellys_daily_report/data/menus.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/kellys_daily_report/data/report_kellys_paperformat.xml b/kellys_daily_report/data/report_kellys_paperformat.xml new file mode 100644 index 000000000..5f6040689 --- /dev/null +++ b/kellys_daily_report/data/report_kellys_paperformat.xml @@ -0,0 +1,22 @@ + + + + + + Kellys report + + custom + 360 + 60 + Portrait + 1 + 3 + 0 + 0 + + 1 + 201 + + + + diff --git a/kellys_daily_report/models/__init__.py b/kellys_daily_report/models/__init__.py new file mode 100644 index 000000000..9bba13048 --- /dev/null +++ b/kellys_daily_report/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2017 Alda Hotels +# Jose Luis Algara +# +# 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 . +# +############################################################################## + +from . import kellysnames diff --git a/kellys_daily_report/models/kellysnames.py b/kellys_daily_report/models/kellysnames.py new file mode 100644 index 000000000..d2b996067 --- /dev/null +++ b/kellys_daily_report/models/kellysnames.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2018 Alda Hotels +# Jose Luis Algara +# +# 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 . +# +############################################################################## +from openerp import models, fields, api + + +class KellysNames(models.Model): + _name = 'kellysnames' + + name = fields.Char('Limpiador/a') diff --git a/kellys_daily_report/report/report_kellys.xml b/kellys_daily_report/report/report_kellys.xml new file mode 100644 index 000000000..902bc2083 --- /dev/null +++ b/kellys_daily_report/report/report_kellys.xml @@ -0,0 +1,194 @@ + + + + + + + + diff --git a/kellys_daily_report/security/ir.model.access.csv b/kellys_daily_report/security/ir.model.access.csv new file mode 100644 index 000000000..dcc559a56 --- /dev/null +++ b/kellys_daily_report/security/ir.model.access.csv @@ -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 diff --git a/kellys_daily_report/static/description/icon.png b/kellys_daily_report/static/description/icon.png new file mode 100644 index 000000000..946adacbe Binary files /dev/null and b/kellys_daily_report/static/description/icon.png differ diff --git a/kellys_daily_report/static/src/css/kellys_daily_report.css b/kellys_daily_report/static/src/css/kellys_daily_report.css new file mode 100644 index 000000000..1a2def628 --- /dev/null +++ b/kellys_daily_report/static/src/css/kellys_daily_report.css @@ -0,0 +1 @@ +.o_datepicker {max-width: 9.5em} diff --git a/kellys_daily_report/views/kellysnames.xml b/kellys_daily_report/views/kellysnames.xml new file mode 100644 index 000000000..3676787f5 --- /dev/null +++ b/kellys_daily_report/views/kellysnames.xml @@ -0,0 +1,16 @@ + + + + + kellysnames + kellysnames.tree.view + + + + + + + + + + diff --git a/kellys_daily_report/wizard/__init__.py b/kellys_daily_report/wizard/__init__.py new file mode 100644 index 000000000..a3dfd1cbe --- /dev/null +++ b/kellys_daily_report/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2018 Alexandre Díaz +# +# 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 . +# +############################################################################## +from . import kellys_daily_pdf +from . import kellys_daily_rooms diff --git a/kellys_daily_report/wizard/kellys_daily_pdf.py b/kellys_daily_report/wizard/kellys_daily_pdf.py new file mode 100644 index 000000000..a3557fd76 --- /dev/null +++ b/kellys_daily_report/wizard/kellys_daily_pdf.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# Copyright (C) 2018 Jose Luis Algara Toledo +# +# 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 . +# +############################################################################## +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,} diff --git a/kellys_daily_report/wizard/kellys_daily_pdf.xml b/kellys_daily_report/wizard/kellys_daily_pdf.xml new file mode 100644 index 000000000..458fcc17b --- /dev/null +++ b/kellys_daily_report/wizard/kellys_daily_pdf.xml @@ -0,0 +1,31 @@ + + + + + + + kellys_daily_report_view + kellysreport + +
+ + + +