diff --git a/hotel_ine/__init__.py b/hotel_ine/__init__.py new file mode 100644 index 000000000..1745965b5 --- /dev/null +++ b/hotel_ine/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2019 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 wizard diff --git a/hotel_ine/__manifest__.py b/hotel_ine/__manifest__.py new file mode 100644 index 000000000..b54b0617b --- /dev/null +++ b/hotel_ine/__manifest__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# Copyright (C) 2019 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 Ine', + 'description': """ + Create de INE Report""", + 'version': '1.0.0', + 'license': 'AGPL-3', + 'summary': "Export hotel data for INE report", + 'author': "Jose Luis Algara (Alda hotels) ", + 'website': 'www.aldahotels.com', + 'depends': ['hotel', 'hotel_l10n_es'], + 'category': 'hotel/ine', + 'data': [ + 'wizard/inewizard.xml', + ], + 'demo': [ + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/hotel_ine/static/description/icon.png b/hotel_ine/static/description/icon.png new file mode 100755 index 000000000..c066d3473 Binary files /dev/null and b/hotel_ine/static/description/icon.png differ diff --git a/hotel_ine/wizard/__init__.py b/hotel_ine/wizard/__init__.py new file mode 100644 index 000000000..53a5cd324 --- /dev/null +++ b/hotel_ine/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2019 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 inewizard diff --git a/hotel_ine/wizard/inewizard.py b/hotel_ine/wizard/inewizard.py new file mode 100644 index 000000000..f2f02b51d --- /dev/null +++ b/hotel_ine/wizard/inewizard.py @@ -0,0 +1,68 @@ +# -*- 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 openerp import models, fields, api, _ +import base64 +import datetime +import calendar +import xml.etree.cElementTree as ET +from openerp.exceptions import UserError + +import logging +_logger = logging.getLogger(__name__) + + +def _get_default_date(option): + now = datetime.datetime.now() + month = int(now.month)-1 + year = int(now.year) + if month <= 0: + month = 12 + year -= year + start_date = datetime.datetime(year, month, 1) + end_date = calendar.monthrange(year, month)[1] - 1 + month_end_date = start_date + datetime.timedelta(days=end_date) + if option == "start": + return start_date + return month_end_date + + +class Wizard(models.TransientModel): + _name = 'ine.wizard' + + @api.onchange('ine_start') + def onchange_ine_start(self): + if self.ine_start > self.ine_end: + self.ine_start = self.ine_end + + txt_filename = fields.Char() + txt_binary = fields.Binary() + ine_start = fields.Date("Fecha inicio", default=_get_default_date('start')) + ine_end = fields.Date("Fecha final", default=_get_default_date('end')) + + adr_screen = fields.Char() + rev_screen = fields.Char() + + +# Debug Stop ------------------- +# import wdb; wdb.set_trace() +# Debug Stop ------------------- diff --git a/hotel_l10n_es/wizard/ine_wizard.xml b/hotel_ine/wizard/inewizard.xml old mode 100755 new mode 100644 similarity index 85% rename from hotel_l10n_es/wizard/ine_wizard.xml rename to hotel_ine/wizard/inewizard.xml index 2838cb1c6..df784f063 --- a/hotel_l10n_es/wizard/ine_wizard.xml +++ b/hotel_ine/wizard/inewizard.xml @@ -1,5 +1,6 @@ - + + - - ine.wizard.form + + INE File Download ine.wizard
- - + +