[IMP] Adapt to hotel module changes

This commit is contained in:
QS5ELkMu
2018-11-09 20:55:26 +01:00
parent 233735bb48
commit 24e8d2a7d7
27 changed files with 57 additions and 461 deletions

View File

@@ -12,11 +12,11 @@
<field name="checkin" required="1" colspan="1"/> <field name="checkin" required="1" colspan="1"/>
<field name="checkout" required="1" colspan="1"/> <field name="checkout" required="1" colspan="1"/>
</group> </group>
<group> <group>
<field name="call_center" invisible="1" /> <field name="call_center" invisible="1" />
<field name="channel_type" required="1" attrs="{'readonly':[('call_center','=',True)]}"/> <field name="channel_type" required="1" attrs="{'readonly':[('call_center','=',True)]}"/>
<field name="partner_id"/> <field name="partner_id"/>
</group> </group>
</group> </group>
<group> <group>
<field name="room_type_wizard_ids" nolabel="1" <field name="room_type_wizard_ids" nolabel="1"
@@ -28,32 +28,32 @@
<field name="min_stay" /> <field name="min_stay" />
<field name="max_rooms" /> <field name="max_rooms" />
<field name="room_type_id" string="Room Type" readonly="1"/> <field name="room_type_id" string="Room Type" readonly="1"/>
<field name="rooms_num" attrs="{'readonly': [('can_confirm','=',False)]}" /> <field name="rooms_num" attrs="{'readonly': [('can_confirm','=',False)]}" />
<field name="checkin" widget="date" /> <field name="checkin" widget="date" />
<field name="checkout" widget="date" /> <field name="checkout" widget="date" />
<field name="discount" attrs="{'readonly': [('can_confirm','=',False)]}"/> <field name="discount" attrs="{'readonly': [('can_confirm','=',False)]}"/>
<field name="price" attrs="{'readonly': [('can_confirm','=',False)]}"/> <field name="price" attrs="{'readonly': [('can_confirm','=',False)]}"/>
<field name="amount_reservation" readonly="1" /> <field name="amount_reservation" readonly="1" />
<field name="total_price" invisible="1" /> <field name="total_price" invisible="1" />
<field name="can_confirm" invisible="1" /> <field name="can_confirm" invisible="1" />
</tree> </tree>
</field> </field>
</group> </group>
<label for="autoassign" attrs="{'invisible': [('autoassign','=', False)]}"/> <label for="autoassign" attrs="{'invisible': [('autoassign','=', False)]}"/>
<field name="autoassign" attrs="{'invisible': [('autoassign','=', False)]}"/> <field name="autoassign" attrs="{'invisible': [('autoassign','=', False)]}"/>
<field name="confirm" invisible="1"/> <field name="confirm" invisible="1"/>
<group colspan="2" class="oe_subtotal_footer"> <group colspan="2" class="oe_subtotal_footer">
<field name="total"/> <field name="total"/>
</group> </group>
<group> <group>
<field name="reservation_wizard_ids" colspan="4" string="Room Lines" <field name="reservation_wizard_ids" colspan="4" string="Room Lines"
nolabel="1" attrs="{'invisible': [('autoassign','=',True)]}"> nolabel="1" attrs="{'invisible': [('autoassign','=',True)]}">
<tree string="Room Line" delete="false" editable="buttom"> <tree string="Room Line" delete="false" editable="buttom">
<field name="product_id" string="Room No" options="{'no_create': True}"/> <field name="product_id" string="Room No" options="{'no_create': True}"/>
<field name="room_type_id" options="{'no_create': True}" /> <field name="room_type_id" options="{'no_create': True}" />
<field name="checkin" /> <field name="checkin" />
<field name="checkout" /> <field name="checkout" />
<field name="nights" /> <field name="nights" />
<field name="adults" /> <field name="adults" />
<field name="children" /> <field name="children" />
<field name="discount" /> <field name="discount" />
@@ -64,25 +64,25 @@
<field name="to_read" invisible="1" /> <field name="to_read" invisible="1" />
<field name="to_assign" invisible="1" /> <field name="to_assign" invisible="1" />
</tree> </tree>
</field> </field>
</group> </group>
<group> <group>
<field name="service_wizard_ids" colspan="4" string="Services" <field name="service_wizard_ids" colspan="4" string="Services"
nolabel="1" > nolabel="1" >
<tree string="Services" editable="buttom"> <tree string="Services" editable="buttom">
<field name="product_id" string="Service" options="{'no_create': True}" <field name="product_id" string="Service" options="{'no_create': True}"
domain="[('isservice','=',True)]"/> domain="[('isservice','=',True)]"/>
<field name="product_uom_qty" /> <field name="product_uom_qty" />
<field name="price_unit" /> <field name="price_unit" />
<field name="discount" /> <field name="discount" />
<field name="price_total" /> <field name="price_total" />
</tree> </tree>
</field> </field>
</group> </group>
<footer> <footer>
<button name="create_folio" string="Create Reservations" type="object" <button name="create_folio" string="Create Reservations" type="object"
class="oe_highlight" /> class="oe_highlight" />
</footer> </footer>
</sheet> </sheet>
</form> </form>
</field> </field>
@@ -92,7 +92,7 @@
<field name="name">Hotel Reservation Wizard</field> <field name="name">Hotel Reservation Wizard</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">hotel.folio.wizard</field> <field name="res_model">hotel.folio.wizard</field>
<field name="view_id" ref="hotel_folio_wizard"/> <field name="view_id" ref="hotel.hotel_folio_wizard"/>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</field>

View File

@@ -29,7 +29,6 @@
'views/room_pricelist_cached_views.xml', 'views/room_pricelist_cached_views.xml',
'views/hotel_reservation_views.xml', 'views/hotel_reservation_views.xml',
'views/hotel_calendar_management_views.xml', 'views/hotel_calendar_management_views.xml',
'data/views.xml',
'data/menus.xml', 'data/menus.xml',
'data/records.xml', 'data/records.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',

View File

@@ -6,7 +6,7 @@
<record id="hotel_calendar_view" model="ir.ui.view"> <record id="hotel_calendar_view" model="ir.ui.view">
<field name="name">Hotel Calendar</field> <field name="name">Hotel Calendar</field>
<field name="model">hotel.reservation</field> <field name="model">hotel.reservation</field>
<field name="inherit_id" ref="hotel.view_hotel_reservation_form" /> <field name="inherit_id" ref="hotel.hotel_reservation_view_form" />
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
@@ -15,7 +15,7 @@
</field> </field>
</record> </record>
<record id="hotel_calendar_management_view" model="ir.ui.view"> <record id="hotel_calendar_management_view_form" model="ir.ui.view">
<field name="name">Hotel Calendar Management</field> <field name="name">Hotel Calendar Management</field>
<field name="model">hotel.calendar.management</field> <field name="model">hotel.calendar.management</field>
<field name="type">form</field> <field name="type">form</field>

View File

@@ -221,8 +221,8 @@ var PMSCalendarController = AbstractController.extend({
_onUpdateButtonsCounter: function (ev) { _onUpdateButtonsCounter: function (ev) {
var self = this; var self = this;
var domain_checkouts = [['is_checkout', '=', true]]; var domain_checkouts = [['checkout', '=', moment().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT)]];
var domain_checkins = [['is_checkin', '=', true]]; var domain_checkins = [['checkin', '=', moment().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT)]];
var domain_overbookings = [['overbooking', '=', true], ['state', 'not in', ['cancelled']]]; var domain_overbookings = [['overbooking', '=', true], ['state', 'not in', ['cancelled']]];
$.when( $.when(
this.model.search_count(domain_checkouts), this.model.search_count(domain_checkouts),

View File

@@ -73,7 +73,7 @@ return AbstractModel.extend({
}, },
get_amenities: function() { get_amenities: function() {
return this._rpc({ return this._rpc({
model: 'hotel.room.amenities', model: 'hotel.amenity',
method: 'search_read', method: 'search_read',
args: [false, ['id','name']], args: [false, ['id','name']],
context: Session.user_context, context: Session.user_context,

View File

@@ -1 +1,2 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -6,7 +6,7 @@
<field name="res_model">hotel.reservation</field> <field name="res_model">hotel.reservation</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="domain">[('is_checkin','=', True)]</field> <field name="domain">[('checkin','=', datetime.datetime.now().strftime('%Y-%m-%d'))]</field>
</record> </record>
<record model="ir.actions.act_window" id="hotel_reservation_action_checkout"> <record model="ir.actions.act_window" id="hotel_reservation_action_checkout">
@@ -14,7 +14,7 @@
<field name="res_model">hotel.reservation</field> <field name="res_model">hotel.reservation</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="domain">[('is_checkout','=', True)]</field> <field name="domain">[('checkout','=', datetime.datetime.now().strftime('%Y-%m-%d'))]</field>
</record> </record>
<record model="ir.actions.act_window" id="hotel_room_pricelist_cached_action_form_tree"> <record model="ir.actions.act_window" id="hotel_room_pricelist_cached_action_form_tree">

View File

@@ -21,16 +21,16 @@
############################################################################## ##############################################################################
{ {
'name': 'Hotel Calendar WuBook', 'name': 'Hotel Calendar Channel Connector',
'version': '1.0', 'version': '1.0',
'author': "Alexandre Díaz (Aloxa Solucións S.L.) <alex@aloxa.eu>", 'author': "Alexandre Díaz <dev@redneboa.es>",
'website': 'https://www.eiqui.com', 'website': 'https://github.com/hootel/hootel',
'category': 'eiqui/hotel', 'category': 'eiqui/hotel',
'summary': "Hotel Calendar", 'summary': "Hotel Calendar Channel Connector",
'description': "Hotel Calendar WuBook", 'description': "Unify 'hotel_calendar' and 'hotel_channel_connector'",
'depends': [ 'depends': [
'hotel_calendar', 'hotel_calendar',
'hotel_wubook_proto', 'hotel_channel_connector',
], ],
'external_dependencies': { 'external_dependencies': {
'python': [] 'python': []

View File

@@ -1,6 +1,6 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es> # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, api from odoo import models, api
class HotelCalendarManagement(models.TransientModel): class HotelCalendarManagement(models.TransientModel):

View File

@@ -1,14 +1,14 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es> # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _ from odoo import models, fields, api, _
class WuBookIssue(models.Model): class HotelChannelConnectorIssue(models.Model):
_inherit = 'hotel.channel.connector.issue' _inherit = 'hotel.channel.connector.issue'
@api.model @api.model
def create(self, vals): def create(self, vals):
issue_id = super(WuBookIssue, self).create(vals) issue_id = super(HotelChannelConnectorIssue, self).create(vals)
self.env['bus.hotel.calendar'].send_issue_notification( self.env['bus.hotel.calendar'].send_issue_notification(
'warn', 'warn',
_("Oops! Issue Reported!!"), _("Oops! Issue Reported!!"),

View File

@@ -2,8 +2,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging import logging
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp import models, fields, api, _ from odoo import models, fields, api, _
from openerp.tools import ( from odoo.tools import (
DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_DATETIME_FORMAT) DEFAULT_SERVER_DATETIME_FORMAT)
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)

View File

@@ -1,37 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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 WuBookIssue(models.Model):
_inherit = 'wubook.issue'
@api.model
def create(self, vals):
issue_id = super(WuBookIssue, self).create(vals)
self.env['bus.hotel.calendar'].send_issue_notification(
'warn',
_("Oops! Issue Reported!!"),
issue_id.id,
issue_id.section,
issue_id.message)
return issue_id

View File

@@ -1,3 +1,3 @@
# Copyright 2018 Alexandre Díaz <dev@redneboa.es> # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_folio #from . import test_folio

View File

@@ -5,7 +5,7 @@
'name': 'Hotel Channel Connector', 'name': 'Hotel Channel Connector',
'version': '1.0', 'version': '1.0',
'author': "Alexandre Díaz <dev@redneboa.es>", 'author': "Alexandre Díaz <dev@redneboa.es>",
'website': 'https://www.eiqui.com', 'website': 'https://github.com/hootel/hootel',
'category': 'hotel/connector', 'category': 'hotel/connector',
'summary': "Hotel Channel Connector Base", 'summary': "Hotel Channel Connector Base",
'description': "Hotel Channel Connector Base", 'description': "Hotel Channel Connector Base",
@@ -18,9 +18,6 @@
}, },
'data': [ 'data': [
'data/cron_jobs.xml', 'data/cron_jobs.xml',
'wizard/wubook_import_plan_prices.xml',
'wizard/wubook_import_plan_restrictions.xml',
'wizard/wubook_import_availability.xml',
'views/general.xml', 'views/general.xml',
'views/hotel_channel_connector_issue_views.xml', 'views/hotel_channel_connector_issue_views.xml',
'views/inherited_hotel_reservation_views.xml', 'views/inherited_hotel_reservation_views.xml',

View File

@@ -1,22 +1,2 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
############################################################################## # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
#
# 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/>.
#
##############################################################################

View File

@@ -197,7 +197,7 @@
<field name="res_model">channel.backend</field> <field name="res_model">channel.backend</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="view_channel_backend_tree"/> <field name="view_id" ref="channel_backend_view_tree"/>
</record> </record>
</odoo> </odoo>

View File

@@ -3,19 +3,12 @@
<record id="hotel_folio_view_form" model="ir.ui.view"> <record id="hotel_folio_view_form" model="ir.ui.view">
<field name="model">hotel.folio</field> <field name="model">hotel.folio</field>
<field name="inherit_id" ref="hotel.view_hotel_folio1_form" /> <field name="inherit_id" ref="hotel.hotel_folio_view_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='partner_internal_comment']" position="before"> <xpath expr="//field[@name='partner_internal_comment']" position="before">
<field name="has_channel_reservations" invisible="True" /> <field name="has_channel_reservations" invisible="True" />
<field name="customer_notes" readonly="True" attrs="{'invisible':[('has_channel_reservations', '=', False)]}"/> <field name="customer_notes" readonly="True" attrs="{'invisible':[('has_channel_reservations', '=', False)]}"/>
</xpath> </xpath>
</field>
</record>
<record id="view_hotel_folio1_form" model="ir.ui.view">
<field name="model">hotel.folio</field>
<field name="inherit_id" ref="hotel.view_hotel_folio1_form" />
<field name="arch" type="xml">
<xpath expr="//notebook/page/field[@name='room_lines']/tree/field[@name='checkout']" position="after"> <xpath expr="//notebook/page/field[@name='room_lines']/tree/field[@name='checkout']" position="after">
<field name="origin_sale"/> <field name="origin_sale"/>
<field name="is_from_ota" invisible="1"/> <field name="is_from_ota" invisible="1"/>

View File

@@ -1,27 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
############################################################################## # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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 wubook_import_plan_prices
from . import wubook_import_plan_restrictions
from . import wubook_import_availability
from . import inherited_massive_changes from . import inherited_massive_changes
from . import inherited_duplicate_reservation from . import inherited_duplicate_reservation
from . import inherited_massive_price_reservation_days from . import inherited_massive_price_reservation_days

View File

@@ -1,26 +1,7 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
############################################################################## # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# from odoo.exceptions import ValidationError
# OpenERP, Open Source Management Solution from odoo import models, api, _
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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.exceptions import ValidationError
from openerp import models, api, _
class MassiveChangesWizard(models.TransientModel): class MassiveChangesWizard(models.TransientModel):

View File

@@ -1,27 +1,8 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
############################################################################## # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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 datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp.exceptions import ValidationError from odoo.exceptions import ValidationError
from openerp import models, api from odoo import models, api
class MassiveChangesWizard(models.TransientModel): class MassiveChangesWizard(models.TransientModel):

View File

@@ -1,25 +1,7 @@
# -*- coding: utf-8 -*- # Copyright 2018 Alexandre Díaz <dev@redneboa.es>
############################################################################## # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# from odoo.exceptions import ValidationError
# OpenERP, Open Source Management Solution from odoo import models, api, _
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
#
# 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.exceptions import ValidationError
from openerp import models, api, _
class MassivePriceChangeWizard(models.TransientModel): class MassivePriceChangeWizard(models.TransientModel):

View File

@@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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.exceptions import ValidationError
from openerp import models, fields, api, _
from ..components.backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT
class ImportAvailabilityWizard(models.TransientModel):
_name = 'wubook.wizard.availability'
date_start = fields.Datetime('Start Date', required=True)
date_end = fields.Datetime('End Date', required=True)
set_max_avail = fields.Boolean('Set max avail?', default=True)
@api.multi
def import_availability(self):
for record in self:
wres = self.env['wubook'].fetch_rooms_values(
record.date_start,
record.date_end,
set_max_avail=record.set_max_avail)
if not wres:
raise ValidationError(_("Can't fetch availability from WuBook"))
return True

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_wubook_import_availability_wizard">
<field name="name">wubook.wizard.availability</field>
<field name="model">wubook.wizard.availability</field>
<field name="arch" type="xml">
<form string="Import WuBook Availability" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<group>
<field name="set_max_avail" />
</group>
<footer>
<button name="import_availability" string="Import" type="object"
class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_wubook_import_availability" model="ir.actions.act_window">
<field name="name">Import Availability</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wubook.wizard.availability</field>
<field name="view_id" ref="view_wubook_import_availability_wizard"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -1,48 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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.exceptions import ValidationError
from openerp import models, fields, api, _
from ..components.backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT
class ImportPlanPricesWizard(models.TransientModel):
_name = 'wubook.wizard.plan.prices'
date_start = fields.Datetime('Start Date', required=True)
date_end = fields.Datetime('End Date', required=True)
@api.multi
def import_plan_prices(self):
pricelist_id = self.env['product.pricelist'].browse(
self.env.context.get('active_id'))
if pricelist_id:
for record in self:
date_start_dt = fields.Date.from_string(record.date_start)
date_end_dt = fields.Date.from_string(record.date_end)
wres = self.env['wubook'].fetch_plan_prices(
pricelist_id.wpid,
date_start_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
date_end_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT))
if not wres:
raise ValidationError(_("Can't fetch plan prices \
from WuBook"))
return True

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_wubook_import_plan_prics_wizard">
<field name="name">wubook.wizard.plan.prices</field>
<field name="model">wubook.wizard.plan.prices</field>
<field name="arch" type="xml">
<form string="Import WuBook Plan Prices" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<footer>
<button name="import_plan_prices" string="Import" type="object"
class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_wubook_import_plan_prices" model="ir.actions.act_window">
<field name="name">Import Plan Prices</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wubook.wizard.plan.prices</field>
<field name="view_id" ref="view_wubook_import_plan_prics_wizard"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2017 Solucións Aloxa S.L. <info@aloxa.eu>
# Alexandre Díaz <dev@redneboa.es>
#
# 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.exceptions import ValidationError
from openerp import models, fields, api, _
from ..components.backend_adapter import DEFAULT_WUBOOK_DATE_FORMAT
class ImportPlanRestrictionsWizard(models.TransientModel):
_name = 'wubook.wizard.plan.restrictions'
date_start = fields.Datetime('Start Date', required=True)
date_end = fields.Datetime('End Date', required=True)
@api.multi
def import_plan_restrictions(self):
restriction_id = self.env['hotel.room.type.restriction'].browse(
self.env.context.get('active_id'))
if restriction_id:
for record in self:
date_start_dt = fields.Date.from_string(record.date_start)
date_end_dt = fields.Date.from_string(record.date_end)
if int(restriction_id.wpid) == 0:
wres = self.env['wubook'].fetch_rooms_values(
date_start_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
date_end_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT))
else:
wres = self.env['wubook'].fetch_rplan_restrictions(
date_start_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
date_end_dt.strftime(DEFAULT_WUBOOK_DATE_FORMAT),
restriction_id.wpid)
if not wres:
raise ValidationError(_("Can't fetch restrictions \
from WuBook"))
return True

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<record model="ir.ui.view" id="view_wubook_import_plan_restrictions_wizard">
<field name="name">wubook.wizard.plan.prices</field>
<field name="model">wubook.wizard.plan.prices</field>
<field name="arch" type="xml">
<form string="Import WuBook Plan Restrictions" >
<group>
<group>
<field name="date_start" required="1" />
</group>
<group>
<field name="date_end" required="1" />
</group>
</group>
<footer>
<button name="import_plan_restrictions" string="Import" type="object"
class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_wubook_import_plan_restrictions" model="ir.actions.act_window">
<field name="name">Import Plan Restrictions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wubook.wizard.plan.restrictions</field>
<field name="view_id" ref="view_wubook_import_plan_restrictions_wizard"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'restriction_id': [active_id]}</field>
</record>
</odoo>