diff --git a/kellys_daily_report/README.rst b/kellys_daily_report/README.rst new file mode 100644 index 000000000..5c4c4d7c7 --- /dev/null +++ b/kellys_daily_report/README.rst @@ -0,0 +1,13 @@ +KELLYS DAILY REPORT +============= + +Export 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..e500e6606 --- /dev/null +++ b/kellys_daily_report/__manifest__.py @@ -0,0 +1,49 @@ +# -*- 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/kellys.xml', + 'wizard/kellys_daily_report.xml', + 'data/menus.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..f7fce2413 --- /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 kellys diff --git a/kellys_daily_report/models/kellys.py b/kellys_daily_report/models/kellys.py new file mode 100644 index 000000000..d2b996067 --- /dev/null +++ b/kellys_daily_report/models/kellys.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/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/kellys.xml b/kellys_daily_report/views/kellys.xml new file mode 100644 index 000000000..29fed54c8 --- /dev/null +++ b/kellys_daily_report/views/kellys.xml @@ -0,0 +1,28 @@ + + + + + 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..f9c37ed42 --- /dev/null +++ b/kellys_daily_report/wizard/__init__.py @@ -0,0 +1,21 @@ +# -*- 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_report diff --git a/kellys_daily_report/wizard/kellys_daily_report.py b/kellys_daily_report/wizard/kellys_daily_report.py new file mode 100644 index 000000000..aa4950b2a --- /dev/null +++ b/kellys_daily_report/wizard/kellys_daily_report.py @@ -0,0 +1,140 @@ +# -*- 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 + + +class KellysWizard(models.TransientModel): + _name = 'kellys' + + @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='hcal_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') + # rooms = self.env['hotel.reservation'].search( + # ['&', '&', ('checkin', '<=', dates), + # ('checkout', '>=', dates), + # ('state', '<>', 'cancelled'), + # ('product_id', '=', x.product_id.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)]) + + @api.multi + def check_report(self): + rooms = self.env['kellysrooms'].search([('id', 'in', + self.habitaciones.ids)], + order=self.order) + return self.env['report'].get_action(rooms, 'report.kellys') + + +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') diff --git a/kellys_daily_report/wizard/kellys_daily_report.xml b/kellys_daily_report/wizard/kellys_daily_report.xml new file mode 100644 index 000000000..b2647842b --- /dev/null +++ b/kellys_daily_report/wizard/kellys_daily_report.xml @@ -0,0 +1,236 @@ + + + + + kellysrooms + kellysrooms.tree.view + + + + + + + + + + + + + + + + + + + + +