mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] add rate plan id from wubook
This commit is contained in:
@@ -22,10 +22,16 @@ class ChannelBackend(models.Model):
|
|||||||
def _get_default_server(self):
|
def _get_default_server(self):
|
||||||
return 'https://wired.wubook.net/xrws/'
|
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')
|
lcode = fields.Char('Channel Service lcode')
|
||||||
pkey = fields.Char('Channel Service PKey')
|
pkey = fields.Char('Channel Service PKey')
|
||||||
server = fields.Char('Channel Service Server',
|
server = fields.Char('Channel Service Server',
|
||||||
default=_get_default_server)
|
default=_get_default_server)
|
||||||
|
wubook_parity_pricelist_id = fields.Many2one('product.pricelist', 'WuBook Parity Pricelist',
|
||||||
|
required=True,
|
||||||
|
default=_get_default_wubook_parity)
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -121,6 +121,8 @@ class HotelReservationImporter(Component):
|
|||||||
if 'tax_inclusive' in broom['ancillary'] and not broom['ancillary']['tax_inclusive']:
|
if 'tax_inclusive' in broom['ancillary'] and not broom['ancillary']['tax_inclusive']:
|
||||||
_logger.info("--- Incoming Reservation without taxes included!")
|
_logger.info("--- Incoming Reservation without taxes included!")
|
||||||
tax_inclusive = False
|
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
|
# Generate Reservation Day Lines
|
||||||
reservation_lines = []
|
reservation_lines = []
|
||||||
tprice = 0.0
|
tprice = 0.0
|
||||||
@@ -141,6 +143,11 @@ class HotelReservationImporter(Component):
|
|||||||
'price': room_day_price,
|
'price': room_day_price,
|
||||||
}))
|
}))
|
||||||
tprice += 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
|
# Get OTA
|
||||||
ota_id = self.env['channel.ota.info'].search([
|
ota_id = self.env['channel.ota.info'].search([
|
||||||
('backend_id', '=', self.backend_record.id),
|
('backend_id', '=', self.backend_record.id),
|
||||||
@@ -163,6 +170,7 @@ class HotelReservationImporter(Component):
|
|||||||
'checkout': checkout_str,
|
'checkout': checkout_str,
|
||||||
'adults': persons,
|
'adults': persons,
|
||||||
'children': book['children'],
|
'children': book['children'],
|
||||||
|
'pricelist_id': rate_id.id,
|
||||||
'reservation_line_ids': reservation_lines,
|
'reservation_line_ids': reservation_lines,
|
||||||
'to_assign': True,
|
'to_assign': True,
|
||||||
'state': is_cancellation and 'cancelled' or 'confirm',
|
'state': is_cancellation and 'cancelled' or 'confirm',
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
<field name="lcode" colspan="2"/>
|
<field name="lcode" colspan="2"/>
|
||||||
<field name="pkey" colspan="2"/>
|
<field name="pkey" colspan="2"/>
|
||||||
</xpath>
|
</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>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user