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

This commit is contained in:
Dario Lodeiros
2019-05-10 21:55:29 +02:00
3 changed files with 23 additions and 0 deletions

View File

@@ -22,10 +22,16 @@ class ChannelBackend(models.Model):
def _get_default_server(self):
return 'https://wired.wubook.net/xrws/'
def _get_default_wubook_parity(self):
return self.env['ir.default'].sudo().get('res.config.settings', 'default_pricelist_id')
lcode = fields.Char('Channel Service lcode')
pkey = fields.Char('Channel Service PKey')
server = fields.Char('Channel Service Server',
default=_get_default_server)
wubook_parity_pricelist_id = fields.Many2one('product.pricelist', 'WuBook Parity Pricelist',
required=True,
default=_get_default_wubook_parity)
@contextmanager
@api.multi

View File

@@ -121,6 +121,8 @@ class HotelReservationImporter(Component):
if 'tax_inclusive' in broom['ancillary'] and not broom['ancillary']['tax_inclusive']:
_logger.info("--- Incoming Reservation without taxes included!")
tax_inclusive = False
# rate_id ( 0: WuBook Parity (aka standard rate); > 0: the id of the booked pricing plan)
rate_id = 0
# Generate Reservation Day Lines
reservation_lines = []
tprice = 0.0
@@ -141,6 +143,11 @@ class HotelReservationImporter(Component):
'price': room_day_price,
}))
tprice += room_day_price
rate_id = brday['rate_id']
# TODO: Review different pricelist in the different booked rooms (folio in Odoo)
rate_id = rate_id > 0 and rate_id or self.env['channel.backend'].sudo().search([
('id', '=', self.backend_record.id)
]).wubook_parity_pricelist_id
# Get OTA
ota_id = self.env['channel.ota.info'].search([
('backend_id', '=', self.backend_record.id),
@@ -163,6 +170,7 @@ class HotelReservationImporter(Component):
'checkout': checkout_str,
'adults': persons,
'children': book['children'],
'pricelist_id': rate_id.id,
'reservation_line_ids': reservation_lines,
'to_assign': True,
'state': is_cancellation and 'cancelled' or 'confirm',

View File

@@ -9,6 +9,15 @@
<field name="lcode" colspan="2"/>
<field name="pkey" colspan="2"/>
</xpath>
<xpath expr="//page[@name='security']" position='after'>
<page string='Booking Engine' name="engine">
<group colspan="4" col="4">
<field name="wubook_parity_pricelist_id" options="{'no_create': True}" colspan="4"/>
</group>
</page>
</xpath>
</field>
</record>