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

This commit is contained in:
Dario Lodeiros
2019-03-23 11:41:30 +01:00
48 changed files with 2142 additions and 1444 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
DOOR CODES
==========
Generate HOTEL DOOR CODES
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-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 . import models
from . import wizard

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2018-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/>.
#
##############################################################################
{
'name': 'Hotel Door Codes',
'version': '2.1',
'author': "Jose Luis Algara Toledo <osotranquilo@gmail.com>",
'website': 'https://www.aldahotels.com',
'category': 'hotel code',
'summary': "Generate Hotel door codes, in Pseudo random system",
'description': "Hotel Door Codes",
'depends': [
'hotel', 'hotel_l10n_es'
],
'data': [
'wizard/door_code.xml',
'data/menus.xml',
'views/inherit_res_company.xml',
'views/inherit_hotel_reservation.xml',
'views/inherit_report_viajero.xml',
],
'qweb': [],
'test': [
],
'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_door_code"
name="Codigos para la Puerta"
parent="hotel.hotel_reports_menu"
action="door_code_act"
groups="hotel.group_hotel_user,hotel.group_hotel_manager"
sequence="45"
/>
</data>
</odoo>

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018-2019 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 inherit_res_company
from . import inherit_hotel_reservation

View File

@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018-2019 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
from datetime import datetime, date, time, timedelta
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class Inherit_hotel_reservation(models.Model):
_inherit = 'hotel.reservation'
@api.multi
def doorcode4(self, fecha):
# Calculate de Door Code... need a date in String format "%Y-%m-%d"
compan = self.env.user.company_id
d = datetime.strptime(fecha, DEFAULT_SERVER_DATE_FORMAT)
dia_semana = datetime.weekday(d) # Dias a restar y ponerlo en lunes
d = d - timedelta(days=dia_semana)
dtxt = d.strftime('%s.%%06d') % d.microsecond
dtxt = compan.precode + dtxt[4:8] + compan.postcode
return dtxt
@api.multi
def _compute_door_codes(self):
for res in self:
entrada = datetime.strptime(
res.checkin[:10], DEFAULT_SERVER_DATE_FORMAT)
if datetime.weekday(entrada) == 0:
entrada = entrada + timedelta(days=1)
salida = datetime.strptime(
res.checkout[:10], DEFAULT_SERVER_DATE_FORMAT)
if datetime.weekday(salida) == 0:
salida = salida - timedelta(days=1)
codes = (u'Código de entrada: ' +
'<strong><span style="font-size: 1.4em;">' +
res.doorcode4(datetime.strftime(entrada, "%Y-%m-%d")) +
'</span></strong>')
while entrada <= salida:
if datetime.weekday(entrada) == 0:
codes += ("<br>" +
u'Cambiará el Lunes ' +
datetime.strftime(entrada, "%d-%m-%Y") +
' a: <strong><span style="font-size: 1.4em;">' +
res.doorcode4(datetime.strftime(
entrada, "%Y-%m-%d")) +
'</span></strong>')
entrada = entrada + timedelta(days=1)
res.door_codes = codes
door_codes = fields.Html(u'Códigos de entrada',
compute='_compute_door_codes')
box_number = fields.Integer ('Numero de Caja')
box_code = fields.Char ('Cod. Caja')

View File

@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018-2019 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 Inherit_res_company(models.Model):
_inherit = 'res.company'
precode = fields.Char('Characters before the door code', default='')
postcode = fields.Char('Characters after the code', default='')

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Hotel Settings -->
<data>
<!-- Inherit Company view to add 'door_code' in Reservation Form -->
<record id="door_code_reservation_form" model="ir.ui.view">
<field name="name">door_code.reservation_form</field>
<field name="model">hotel.reservation</field>
<field name="inherit_id" ref="hotel.hotel_reservation_view_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='others']" position="after">
<page name="doorcode" string="Códigos entrada">
<group>
<field name="door_codes" />
<field name="box_number" />
<field name="box_code" />
</group>
</page>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Hotel Settings -->
<data>
<!-- Inherit viajero repdort to add 'door_code' -->
<template id="door_code_view_report" inherit_id="hotel_l10n_es.report_viajero_document">
<xpath expr="//div[@class='final']" position="replace">
<div class ="doorcodes" style="font-size:1.8em;">
<span t-field="o.reservation_id.door_codes"/>
</div>
</xpath>
</template>
</data>
</odoo>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Hotel Settings -->
<data>
<!-- Inherit Company view to add 'door_code' -->
<record id="door_code_view_company_form" model="ir.ui.view">
<field name="name">door_code.config.view_company_form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='cardex_warning']" position="after">
<field name="precode" />
<field name="postcode" />
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018-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 . import door_code

View File

@@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2018-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/>.
#
##############################################################################
import datetime
from datetime import datetime, date, time, timedelta
from odoo import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class DoorCodeWizard(models.TransientModel):
_name = 'door_code'
@api.model
def _get_default_date_start(self):
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
date_start = fields.Date("Inicio periodo",
default=_get_default_date_start)
date_end = fields.Date("Fin del periodo",
default=_get_default_date_start)
door_code = fields.Html(u'Código para la puerta')
@api.multi
def doorcode4(self, fecha):
# Calculate de Door Code... need a date in String format "%Y-%m-%d"
compan = self.env.user.company_id
d = datetime.strptime(fecha, DEFAULT_SERVER_DATE_FORMAT)
dia_semana = datetime.weekday(d) # Dias a restar y ponerlo en lunes
d = d - timedelta(days=dia_semana)
dtxt = d.strftime('%s.%%06d') % d.microsecond
dtxt = compan.precode + dtxt[4:8] + compan.postcode
return dtxt
@api.multi
def check_code(self):
entrada = datetime.strptime(
self.date_start, DEFAULT_SERVER_DATE_FORMAT)
if datetime.weekday(entrada) == 0:
entrada = entrada + timedelta(days=1)
salida = datetime.strptime(
self.date_end, DEFAULT_SERVER_DATE_FORMAT)
if datetime.weekday(salida) == 0:
salida = salida - timedelta(days=1)
codes = (u'Código de entrada: ' +
'<strong><span style="font-size: 2em;">' +
self.doorcode4(self.date_start) +
'</span></strong>')
while entrada <= salida:
if datetime.weekday(entrada) == 0:
codes += ("<br>" +
u'Cambiará el Lunes ' +
datetime.strftime(entrada, "%d-%m-%Y") +
' a: <strong><span style="font-size: 2em;">' +
self.doorcode4(datetime.strftime(
entrada, "%Y-%m-%d")) +
'</span></strong>')
entrada = entrada + timedelta(days=1)
return self.write({
'door_code': codes
})

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" ?>
<odoo>
<data>
<record model="ir.ui.view" id="hotel_door_code_view">
<field name="name">door_code.view</field>
<field name="model">door_code</field>
<field name="arch" type="xml">
<form string="Door Code Generator" >
<sheet>
<group>
<group>
<field name="date_start" required="1" />
<field name="date_end" required="1" />
</group>
</group>
<group>
<field name="door_code" readonly="1"/>
</group>
<footer>
<button name="check_code" string="Generate Code" type="object" class="oe_highlight" />
</footer>
</sheet>
</form>
</field>
</record>
<act_window
id="door_code_act"
name="Door Code Generator"
res_model="door_code"
view_mode="form"
/>
</data>
</odoo>

0
hotel_l10n_es/README.rst Normal file → Executable file
View File

0
hotel_l10n_es/__init__.py Normal file → Executable file
View File

3
hotel_l10n_es/__manifest__.py Normal file → Executable file
View File

@@ -34,6 +34,7 @@
'partner_contact_gender',
'partner_contact_birthdate',
'partner_firstname',
'web_responsive'
],
'data': [
'data/code.ine.csv',
@@ -53,7 +54,7 @@
'views/report_viajero_head.xml',
'views/report_viajero_data.xml',
'views/report_viajero.xml',
'static/src/xml/hotel_l10n_es_templates.xml'
'views/hotel_l10n_es_hotel_name.xml'
],
'test': [
],

0
hotel_l10n_es/data/code.ine.csv Normal file → Executable file
View File

0
hotel_l10n_es/data/report_viajero_paperformat.xml Normal file → Executable file
View File

0
hotel_l10n_es/data/tourism.category.csv Normal file → Executable file
View File

0
hotel_l10n_es/i18n/es.po Normal file → Executable file
View File

0
hotel_l10n_es/models/__init__.py Normal file → Executable file
View File

0
hotel_l10n_es/models/category_type.py Normal file → Executable file
View File

0
hotel_l10n_es/models/code_ine.py Normal file → Executable file
View File

0
hotel_l10n_es/models/inherit_hotel_checkin_partner.py Normal file → Executable file
View File

0
hotel_l10n_es/models/inherit_res_company.py Normal file → Executable file
View File

0
hotel_l10n_es/models/inherit_res_partner.py Normal file → Executable file
View File

0
hotel_l10n_es/report/report_parte_viajero.xml Normal file → Executable file
View File

0
hotel_l10n_es/security/ir.model.access.csv Normal file → Executable file
View File

View File

@@ -0,0 +1,5 @@
#odooAppDrawer{background: #FFFFFF url(../img/watermark.jpg) no-repeat fixed center}
tbody tr td div.o_datepicker.o_form_field_date.o_form_field.o_form_required{max-width: 9.5em}
.title-hotel-name{font-size: 20px;position: absolute;text-align: center;width: 100%;color: #45c2b1;font-weight: bold;z-index: -1;}
.title-hotel-name2{font-size: 20px;position: absolute;text-align: center;width: 100%;color: #45c2b1;font-weight: bold;z-index: -1;}
body {background-color: blue;}

0
hotel_l10n_es/views/category_tourism.xml Normal file → Executable file
View File

0
hotel_l10n_es/views/code_ine.xml Normal file → Executable file
View File

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="hotelname_bootstrap" inherit_id="web.menu_secondary" name="Hotel Name - Web Client">
<!-- <templateid="hotelname_bootstrap" inherit_id="web.menu_secondary" name="Hotel Name - Web Client"> -->
<xpath expr="//div[hasclass('o_sub_menu_content')]/t" position="after">
<!-- <xpath expr="//div[@class='o_sub_menu_content']/t" position="after"> -->
<link href="/hotel_l10n_es/static/src/css/hotel_l10n_es.css" rel="stylesheet" type="text/css"/>
<div class="title-hotel-name">
<t t-esc="request.env.user.company_id.property_name"/>
</div>
</xpath>
</template>
</odoo>

View File

0
hotel_l10n_es/views/inherit_res_company.xml Normal file → Executable file
View File

0
hotel_l10n_es/views/inherit_res_partner.xml Normal file → Executable file
View File

0
hotel_l10n_es/views/report_viajero.xml Normal file → Executable file
View File

0
hotel_l10n_es/views/report_viajero_data.xml Normal file → Executable file
View File

12
hotel_l10n_es/views/report_viajero_document.xml Normal file → Executable file
View File

@@ -16,10 +16,10 @@
<span t-field="company.city"/>, at
<span t-esc="time.strftime('%Y-%m-%d')" t-options="{&quot;widget&quot;: &quot;date&quot;}"/>
</p>
<div class="firma" style="width: 85%; border:dotted 1px; height: 60px; margin:0 auto;"></div><br/>
<div class="firma" style="width: 85%; border:dotted 1px; height: 80px; margin:0 auto;"></div><br/>
<p class="text-center">Traveler's signature</p>
<p class="text-center" style="font-size:0.8em;"><span t-field="company.cardex_warning"/></p>
<p class="text-justify" style="font-size:0.7em;">En nombre de la empresa
<p class="text-center" style="font-size:1.3em;"><span t-field="company.cardex_warning"/></p>
<p class="text-justify" style="font-size:1.1em;">En nombre de la empresa
<strong>GRUPO ALDA HOTELS</strong>
compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio
solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una
@@ -46,8 +46,8 @@
<p class="text-center">
<strong>COPY TO THE USER</strong>
</p>
<p class="text-center" style="font-size:0.8em;"><span t-field="company.cardex_warning"/></p>
<p class="text-justify" style="font-size:0.7em;">En nombre de la empresa
<p class="text-center" style="font-size:1.3em;"><span t-field="company.cardex_warning"/></p>
<p class="text-justify" style="font-size:1.1em;">En nombre de la empresa
<strong>GRUPO ALDA HOTELS</strong>
compuesto por Alda Rías Baixas SL, Alda Compostela SL, Alda Castilla SL, Hoteles Rías Altas SL, Comphostel Gestión Patrimonial SL y Consultores Hoteleros Integrales SL, tratamos la información que nos facilita, con el fin de prestarle el servicio
solicitado y realizar la facturación del mismo. Se conservarán mientras se mantenga la relación comercial o durante los años necesarios para cumplir con las obligaciones legales. No se cederán a terceros salvo en los casos en que exista una
@@ -56,6 +56,8 @@
Asimismo hemos solicitado que confirme esta autorización para ofrecerle nuestros servicios y poder fidelizarle como cliente.</p>
</div>
</div>
<div class="final">
</div>
</template>
</data>
</odoo>

0
hotel_l10n_es/views/report_viajero_document_new.xml Normal file → Executable file
View File

0
hotel_l10n_es/views/report_viajero_head.xml Normal file → Executable file
View File

0
hotel_l10n_es/wizard/__init__.py Normal file → Executable file
View File

0
hotel_l10n_es/wizard/ine_wizard.py Normal file → Executable file
View File

0
hotel_l10n_es/wizard/ine_wizard.xml Normal file → Executable file
View File

8
hotel_l10n_es/wizard/police_wizard.py Normal file → Executable file
View File

@@ -37,6 +37,7 @@ class PoliceWizard(models.TransientModel):
txt_binary = fields.Binary()
txt_message = fields.Char()
log_police = fields.Char()
error_partner = fields.Many2one('res.partner')
@api.one
def generate_file(self):
@@ -56,6 +57,7 @@ class PoliceWizard(models.TransientModel):
if ((line.partner_id.document_type is not False)
and (line.partner_id.document_number is not False)
and (line.partner_id.firstname is not False)
and (line.partner_id.gender is not False)
and (line.partner_id.lastname is not False)):
log_police += 1
@@ -101,11 +103,13 @@ class PoliceWizard(models.TransientModel):
content += """
"""
else:
self.error_partner = line.partner_id
return self.write({
'error_partner': line.partner_id.id,
'txt_message': _('Problem generating the file. \
Checkin without data, \
or incorrect data: - ' +
line.partner_id.name)})
or incorrect data: ')})
log_police = str(log_police) + _(' records added from ')
log_police += str(len(lines)) + _(' records processed.')
return self.write({

2
hotel_l10n_es/wizard/police_wizard.xml Normal file → Executable file
View File

@@ -26,7 +26,7 @@
<group colspan="1">
<div>
<p><field name="log_police" readonly="1"/></p>
<p><field name="txt_message" readonly="1"/></p>
<p><field name="txt_message" readonly="1"/><strong><field name="error_partner" readonly="1"/></strong></p>
</div>
</group>
<group>