diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py
index ff768ccc2..c5f3201a2 100644
--- a/hotel/__manifest__.py
+++ b/hotel/__manifest__.py
@@ -29,7 +29,6 @@
'data/menus.xml',
'views/inherited_account_payment_views.xml',
'views/inherited_account_invoice_views.xml',
- 'wizard/checkinwizard.xml',
'wizard/massive_price_reservation_days.xml',
'wizard/folio_make_invoice_advance_views.xml',
'data/hotel_sequence.xml',
diff --git a/hotel/wizard/__init__.py b/hotel/wizard/__init__.py
index 9fbcd6f9e..2717e90d1 100644
--- a/hotel/wizard/__init__.py
+++ b/hotel/wizard/__init__.py
@@ -22,7 +22,6 @@
#
##############################################################################
from . import folio_make_invoice_advance
-from . import checkinwizard
from . import massive_changes
from . import split_reservation
from . import duplicate_reservation
diff --git a/hotel/wizard/checkinwizard.py b/hotel/wizard/checkinwizard.py
deleted file mode 100644
index 8bb5b669e..000000000
--- a/hotel/wizard/checkinwizard.py
+++ /dev/null
@@ -1,221 +0,0 @@
-import logging
-from openerp import models, fields, api
-_logger = logging.getLogger(__name__)
-
-
-class Wizard(models.TransientModel):
- _name = 'checkin.wizard'
-
- def default_enter_date(self):
- if ('reservation_ids' and 'folio') in self.env.context:
- ids = [item[1] for item in self.env.context.get('reservation_ids')]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.checkin
- if 'enter_date' in self.env.context:
- return self.env.context['enter_date']
- return False
-
- def default_exit_date(self):
- if ('reservation_ids' and 'folio') in self.env.context:
- ids = [item[1] for item in self.env.context.get('reservation_ids')]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.checkout
- if 'exit_date' in self.env.context:
- return self.env.context['exit_date']
- return False
-
- def default_reservation_id(self):
- if ('reservation_ids' and 'folio') in self.env.context:
- ids = [item[1] for item in self.env.context.get('reservation_ids')]
- reservations = self.env['hotel.reservation'].browse(ids)
- if len(reservations) == 1:
- # return current room line (onlyone in this case)
- return reservations
- for res in reservations:
- # return the first room line with free space for a checkin
- # TODO: add 'done' to res.state condition... Maybe too restrictive right now
- if res.checkin_partner_count < (res.adults + res.children) and \
- res.state not in ["cancelled"]:
- return res
- elif 'reservation_id' in self.env.context:
- return self.env['hotel.reservation'].browse(
- self.env.context['reservation_id'])
-
- _logger.info('default_reservation_id is FALSE')
- return False
-
- def default_partner_id(self):
- # no partner by default. User must search and choose one
- return False
-
- def default_checkin_partner_ids(self):
- if ('reservation_ids' and 'folio') in self.env.context:
- ids = [item[1] for item in self.env.context.get('reservation_ids')]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.checkin_partner_ids
-
- def default_checkin_partner_ids(self):
- if ('reservation_ids' and 'folio') in self.env.context:
- ids = [item[1] for item in self.env.context.get('reservation_ids')]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.segmentation_id
-
- ''' TODO: clean-up
- def default_count_checkin_partner(self):
- if 'reservation_ids' and 'folio' in self.env.context:
- ids = [item[1] for item in self.env.context['reservation_ids']]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.checkin_partner_count
- '''
- ''' TODO: clean-up
- def default_pending_checkin_partner(self):
- if 'reservation_ids' and 'folio' in self.env.context:
- ids = [item[1] for item in self.env.context['reservation_ids']]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- return res.adults + res.children - res.checkin_partner_count
- '''
- ''' TODO: clean-up - list of checkins on smart button clean is not used anymore
- def comp_checkin_list_visible(self):
- if 'partner_id' in self.env.context:
- self.list_checkin_checkin_partner = False
- return
- '''
- def comp_checkin_edit(self):
- if 'edit_checkin_partner' in self.env.context:
- return True
- return False
-
- checkin_partner_ids = fields.Many2many('hotel.checkin.partner', 'reservation_id',
- default=default_checkin_partner_ids)
- # count_checkin_partner = fields.Integer('Checkin counter',
- # default=default_count_checkin_partner)
- # pending_checkin_partner = fields.Integer('Checkin pending',
- # default=default_pending_checkin_partner)
- partner_id = fields.Many2one('res.partner',
- default=default_partner_id)
- reservation_id = fields.Many2one('hotel.reservation',
- default=default_reservation_id)
- enter_date = fields.Date(default=default_enter_date,
- required=True)
- exit_date = fields.Date(default=default_exit_date,
- required=True)
-
- firstname_checkin_partner = fields.Char('Firstname',
- required=True)
- lastname_checkin_partner = fields.Char('Lastname',
- required=True)
-
- email_checkin_partner = fields.Char('E-mail')
-
- mobile_checkin_partner = fields.Char('Mobile')
-
- segmentation_ids = fields.Many2many(
- related='reservation_id.segmentation_ids')
-
-
- ''' TODO: clean-up - list of checkins on smart button clean is not used anymore
- list_checkin_checkin_partner = fields.Boolean(compute=comp_checkin_list_visible,
- default=True, store=True)
- '''
- # edit_checkin_checkin_partner = fields.Boolean(default=comp_checkin_edit,
- # store=True)
-
- op_select_partner = fields.Selection([
- ('S', 'Select a partner for checkin'),
- ('C', 'Create a new partner for checkin')
- ], default='S', string='Partner for checkin')
- # checkin mode:
- # 0 - no selection made by the user, so hide the client fields
- # 1 - select a client for update his values and do the checkin
- # 2 - create a new client with the values and do the checkin
- checkin_mode = fields.Integer(default=0)
-
- @api.multi
- def action_save_check(self):
- # prepare partner values
- if self.op_select_partner == 'S':
- partner_vals = {
- 'id': self.partner_id.id,
- 'firstname': self.firstname_checkin_partner,
- 'lastname': self.lastname_checkin_partner,
- 'email': self.email_checkin_partner,
- 'mobile': self.mobile_checkin_partner,
- }
- self.partner_id.sudo().write(partner_vals)
- elif self.op_select_partner == 'C':
- partner_vals = {
- 'firstname': self.firstname_checkin_partner,
- 'lastname': self.lastname_checkin_partner,
- 'email': self.email_checkin_partner,
- 'mobile': self.mobile_checkin_partner,
- }
- new_partner = self.env['res.partner'].create(partner_vals)
- self.partner_id = self.env['res.partner'].browse(new_partner.id)
-
- # prepare checkin values
- checkin_partner_val = {
- 'partner_id': self.partner_id.id,
- 'enter_date': self.enter_date,
- 'exit_date': self.exit_date
- }
- record_id = self.env['hotel.reservation'].browse(
- self.reservation_id.id)
- # save the checkin for this reservation
- record_id.write({
- 'checkin_partner_ids': [(0, False, checkin_partner_val)],
- 'segmentation_id': self.segmentation_id,
- })
-
- # update the state of the current reservation
- if record_id.checkin_partner_count > 0:
- record_id.state = 'booking'
-
- @api.onchange('reservation_id')
- def change_enter_exit_date(self):
- record_id = self.env['hotel.reservation'].browse(
- self.reservation_id.id)
-
- self.enter_date = record_id.checkin
- self.exit_date = record_id.checkout
-
- ''' trying to filter the reservations only to pending checkins ...
- if 'reservation_ids' and 'folio' in self.env.context:
- ids = [item[1] for item in self.env.context['reservation_ids']]
- reservations = self.env['hotel.reservation'].browse(ids)
- for res in reservations:
- _logger.info('reservation checkin_partner_count %d', res.checkin_partner_count)
-
- # return {
- # 'domain': {'reservation_id': [('folio_id','=', self.env.context['folio']), 'count_checkin_partner','=','2']},
- # 'warning': {'title': "Warning", 'message': self.env.context['checkin_partner_count']},
- # }
- '''
-
- @api.onchange('partner_id')
- def onchange_partner_id(self):
- # update partner fields
- write_vals = {
- 'firstname_checkin_partner': self.partner_id.firstname,
- 'lastname_checkin_partner': self.partner_id.lastname,
- 'email_checkin_partner': self.partner_id.email,
- 'mobile_checkin_partner': self.partner_id.mobile,
- }
- # show the checkin fields if a partner is selected
- if self.op_select_partner == 'S' and self.partner_id.id != False:
- write_vals.update({'checkin_mode': 1})
- self.update(write_vals)
-
- @api.onchange('op_select_partner')
- def onchange_op_select_partner(self):
- # field one2many return false is record does not exist
- if self.op_select_partner == 'S' and self.partner_id.id:
- self.checkin_mode = 1
- # field one2many return 0 on empty record (nothing typed)
- elif self.op_select_partner == 'C' and self.partner_id.id == 0:
- self.checkin_mode = 2
diff --git a/hotel/wizard/checkinwizard.xml b/hotel/wizard/checkinwizard.xml
deleted file mode 100644
index 6b582c9c9..000000000
--- a/hotel/wizard/checkinwizard.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
- wizard.form2
- checkin.wizard
-
-
-
-
-
-
- Add Check
- checkin.wizard
-
- new
-
-
-
-
-
-
-
-
diff --git a/hotel_l10n_es/__manifest__.py b/hotel_l10n_es/__manifest__.py
index 39e66b520..34086fe90 100644
--- a/hotel_l10n_es/__manifest__.py
+++ b/hotel_l10n_es/__manifest__.py
@@ -43,7 +43,6 @@
'views/report_viajero.xml',
'wizard/police_wizard.xml',
'wizard/ine_wizard.xml',
- 'wizard/inherit_checkin_wizard.xml',
'views/category_tourism.xml',
'views/code_ine.xml',
'views/inherit_res_company.xml',
diff --git a/hotel_l10n_es/wizard/__init__.py b/hotel_l10n_es/wizard/__init__.py
index 0bd21cdd8..9da10d1bc 100644
--- a/hotel_l10n_es/wizard/__init__.py
+++ b/hotel_l10n_es/wizard/__init__.py
@@ -21,5 +21,4 @@
##############################################################################
from . import police_wizard
-from . import inherit_checkin_wizard
from . import ine_wizard
diff --git a/hotel_l10n_es/wizard/inherit_checkin_wizard.py b/hotel_l10n_es/wizard/inherit_checkin_wizard.py
deleted file mode 100644
index f768a92ca..000000000
--- a/hotel_l10n_es/wizard/inherit_checkin_wizard.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# -*- 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
-from openerp.exceptions import UserError
-from openerp.tools.translate import _
-from datetime import datetime, timedelta
-
-class CheckinWizard(models.TransientModel):
- _inherit = 'checkin.wizard'
-
- def validation_under_age(self):
- if self.birthdate_date_cardex != False:
- years = str(datetime.now().date() - timedelta(days=365*16+4))
- limit_date = datetime.strptime(years, "%Y-%m-%d")
- birth_date = datetime.strptime(self.birthdate_date_cardex, '%Y-%m-%d')
- limit = str(limit_date.day)+ ' de ' + str(limit_date.month)+ ' de ' + str(limit_date.year)
- if limit_date < birth_date:
- return {'warning': {'title': _('Error in Birthdate'), 'message': _('Does the client have less than 16 years?. Data collection is not performed for those born before %s.' % (limit)),},}
- if self.polexpedition_cardex != False:
- if self.birthdate_date_cardex > self.polexpedition_cardex:
- raise ValidationError(_('Date of document shipment, prior to birth date'))
-
- @api.onchange('polexpedition_cardex')
- def validation_polexpedition(self):
- if self.birthdate_date_cardex != False and self.polexpedition_cardex != False:
- if self.birthdate_date_cardex > self.polexpedition_cardex:
- return {'warning': {'title': _('Error in Birthdate or Expedition date'), 'message': _('Date of document shipment, prior to birth date'),},}
-
- # Validation for DNI/Permiso conducir erroneo
- @api.onchange('poldocument_cardex', 'documenttype_cardex')
- def validation_poldocument_dni(self):
- if self.poldocument_cardex != False:
- if self.documenttype_cardex in ['D','C']:
- validcaracter = "TRWAGMYFPDXBNJZSQVHLCKE"
- dig_ext = "XYZ"
- reemp_dig_ext = {'X':'0', 'Y':'1', 'Z':'2'}
- numeros = "1234567890"
- dni = self.poldocument_cardex.upper()
- if len(dni) == 9:
- dig_control = dni[8]
- dni = dni[:8]
- # 'extranjero empieza por XYZ'
- if dni[0] in dig_ext:
- dni = dni.replace(dni[0], reemp_dig_ext[dni[0]])
- if not ((len(dni) == len([n for n in dni if n in numeros])) and (validcaracter[int(dni)%23] == dig_control)):
- return {'warning': {'title': _('Error in DNI/NIE/DRIVE LICENSE'), 'message': _('Wrong DNI/NIE/DRIVE LICENSE, check it.'),},}
- else:
- return {'warning': {'title': _('Error in DNI/NIE/DRIVE LICENSE'), 'message': _('DNI/NIE/DRIVE LICENSE erroneous length, the correct format is: (12345678A or X1234567A)'),},}
-
- # Validation for Tipo de documento no valido para Extranjero
- # @api.onchange('x')
- # Pendiente
-
- # Validation for Nacionalidad erronea
- # @api.onchange('x')
- # Pendiente
-
- # NOTE: All the fields are required but they are set required=True in the .xml
- # The reason is found in the bt_select_partner and bt_create_partner buttons to bypass the ORM null constraint
- # when the buttons are clicked to show the hidden fields
-
- documenttype_cardex = fields.Selection([
- ('D', 'DNI'),
- ('P', 'Pasaporte'),
- ('C', 'Permiso de Conducir'),
- ('I', 'Carta o Doc. de Identidad'),
- ('N', 'Permiso Residencia EspaƱol'),
- ('X', 'Permiso Residencia Europeo')],
- help='Select a valid document type',
- default='D',
- string='Doc. type')
-
- poldocument_cardex = fields.Char('Doc. number')
-
- polexpedition_cardex = fields.Date('Expedition date')
-
- gender_cardex = fields.Selection([('male', 'Male'), ('female', 'Female')])
-
- birthdate_date_cardex = fields.Date("Birthdate")
-
- code_ine_cardex = fields.Many2one('code.ine',
- help='Country or province of origin. Used for INE statistics.')
-
- # TODO: Add tags in the cardex not in the partner anb move this field to out of localization
- #category_id_cardex = fields.Many2many('res.partner.category', 'id', required=True)
-
- @api.multi
- def pdf_viajero(self, cardex_id):
- cardex = self.env['cardex'].search([('id', '=', cardex_id)])
- return self.env['report'].get_action(cardex, 'action.report.viajero')
-
- @api.multi
- def action_save_check(self):
- # Check dates
- self.validation_under_age()
- # take a 'snapshot' of the current cardexes in this reservation
- record_id = self.env['hotel.reservation'].browse(self.reservation_id.id)
- old_cardex = self.env['cardex'].search([('reservation_id', '=', record_id.id)])
-
- # the above lines must be executed before call the super().action_save_check()
-
- # call the super action_save_check() for checkin
- super(Wizard, self).action_save_check()
-
- # prepare category in partner from category_id
- the_list = self.segmentation_id - self.partner_id.category_id
- the_list = self.partner_id.category_id + the_list
-
- # prepare localization partner values
- partner_vals = {
- 'documenttype': self.documenttype_cardex,
- 'poldocument': self.poldocument_cardex,
- 'polexpedition': self.polexpedition_cardex,
- 'gender': self.gender_cardex,
- 'birthdate_date': self.birthdate_date_cardex,
- # (4, ID) link to existing record with id = ID (adds a relationship) ...
- 'code_ine': self.code_ine_cardex.id,
- # (6, 0, [IDs]) replace the list of linked IDs ...
- 'category_id': [(6, False, [x.id for x in the_list])],
- }
-
- # Update Accounting VAT number on customer
- if self.documenttype_cardex in ('D','C'):
- partner_vat = 'ES' + self.poldocument_cardex
- partner_vals.update({
- 'vat': partner_vat
- })
-
- # Are you templed to merge the following write with the super() ?
- # Be warned: Premature optimization is the root of all evil -- DonaldKnuth
- # This TransientModel inherit from checkin.wizard and it is intended for localization
- # So, if you need to write something here must be _after_ the super()
-
- # update the localization partner values for this reservation
- self.partner_id.sudo().write(partner_vals);
-
- # get the last cardex in this reservation (set difference theory)
- cardex = self.env['cardex'].search([('reservation_id', '=', record_id.id)]) - old_cardex
- return self.pdf_viajero(cardex.id)
-
- @api.onchange('partner_id')
- def onchange_partner_id(self):
- # call the super update_partner_fields
- super(Wizard, self).onchange_partner_id()
- # update local fields
- self.documenttype_cardex = self.partner_id.documenttype;
- self.poldocument_cardex = self.partner_id.poldocument;
- self.polexpedition_cardex = self.partner_id.polexpedition;
- self.gender_cardex = self.partner_id.gender;
- self.birthdate_date_cardex = self.partner_id.birthdate_date;
- self.code_ine_cardex = self.partner_id.code_ine;
- #self.category_id_cardex = self.partner_id.category_id;
diff --git a/hotel_l10n_es/wizard/inherit_checkin_wizard.xml b/hotel_l10n_es/wizard/inherit_checkin_wizard.xml
deleted file mode 100644
index ed1e8c69f..000000000
--- a/hotel_l10n_es/wizard/inherit_checkin_wizard.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- wizard.form2
- checkin.wizard
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-