Fixes for channel manager
This commit is contained in:
parent
21106a03d0
commit
05d36002c4
25
booking.py
25
booking.py
|
@ -3,6 +3,7 @@
|
|||
from datetime import datetime, timedelta, date
|
||||
from decimal import Decimal
|
||||
import copy
|
||||
import random
|
||||
|
||||
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
||||
from trytond.wizard import (
|
||||
|
@ -105,7 +106,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
plan = fields.Selection(PLAN, 'Commercial Plan', states=STATES_BLOCKED,
|
||||
help="Plans offered by hotel and selected by guest for booking.")
|
||||
plan_string = plan.translated('plan')
|
||||
comments = fields.Text('Comments', states=STATES_BLOCKED)
|
||||
notes = fields.Text('Notes', states=STATES_BLOCKED)
|
||||
reason = fields.Selection(REASON, 'Tourism Segment', states=STATES_BLOCKED)
|
||||
reason_string = reason.translated('segment')
|
||||
guarantee = fields.Selection(GUARANTEE, 'Guarantee', states=STATES_BLOCKED)
|
||||
|
@ -118,7 +119,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
digits=(16, 2), depends=['lines']), 'get_total_amount')
|
||||
collect_amount = fields.Function(fields.Numeric('Collect Amount',
|
||||
digits=(16, 2), depends=['lines']), 'get_collect_amount')
|
||||
code = fields.Char('Code', states={'readonly': True})
|
||||
booker = fields.Many2One('party.party', 'Booker',
|
||||
states={'readonly': True})
|
||||
created_channel = fields.DateTime('Created Channel',
|
||||
|
@ -193,6 +193,12 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
help="Commission collection mode")
|
||||
link_web_checkin = fields.Function(fields.Char('Link Web Check-in'),
|
||||
'get_link_web_checkin')
|
||||
channel_manager = fields.Selection([
|
||||
('wubook', 'Wubook'),
|
||||
('', ''),
|
||||
], 'Channel Manager')
|
||||
reservation_code = fields.Char('Reservation Code',
|
||||
states={'readonly': False})
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -339,6 +345,21 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
now = datetime.now()
|
||||
return now
|
||||
|
||||
@classmethod
|
||||
def get_random_room(cls, product, arrival_date, departure_date):
|
||||
pool = Pool()
|
||||
Folio = pool.get('hotel.folio')
|
||||
Room = pool.get('hotel.room')
|
||||
rooms = Room.search_read([
|
||||
('templates', '=', product.template.id)
|
||||
])
|
||||
rooms_ids = [room['id'] for room in rooms]
|
||||
print('rooms....', rooms_ids)
|
||||
rooms_avail = Folio.get_available_rooms(
|
||||
arrival_date, departure_date, rooms_ids)
|
||||
selected = random.randint(0, len(rooms_avail))
|
||||
return rooms_avail[selected]
|
||||
|
||||
def _round_taxes(self, taxes):
|
||||
if not self.currency:
|
||||
return
|
||||
|
|
1
folio.py
1
folio.py
|
@ -735,7 +735,6 @@ class Folio(ModelSQL, ModelView):
|
|||
rooms_not_available_ids.extend(mnt.room.id for mnt in maintenance)
|
||||
|
||||
rooms_available_ids = set(rooms_ids) - set(rooms_not_available_ids)
|
||||
print('rooms_available_ids >> ', rooms_available_ids)
|
||||
return list(rooms_available_ids)
|
||||
|
||||
def update_nights(self, arrival_date, departure_date):
|
||||
|
|
6
party.py
6
party.py
|
@ -160,21 +160,15 @@ class Party(metaclass=PoolMeta):
|
|||
return address.city_code.id
|
||||
|
||||
def set_country(records, name, value):
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
pass
|
||||
|
||||
def set_subdivision(records, name, value):
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
for rec in records:
|
||||
for address in rec.addresses:
|
||||
address.department_code = value
|
||||
rec.save()
|
||||
|
||||
def set_city(records, name, value):
|
||||
# print("Aqui fue........")
|
||||
# print(records, name, value)
|
||||
for rec in records:
|
||||
for address in rec.addresses:
|
||||
address.city_code = value
|
||||
|
|
|
@ -100,7 +100,7 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
"""Get the best available price list for the context
|
||||
arrival_date: Date
|
||||
departure_date: Date (Optional)
|
||||
rate_plan: Required
|
||||
rate_plan_id: Required
|
||||
occupancy_rate for the arrival_date: Computed (Optional)
|
||||
"""
|
||||
pool = Pool()
|
||||
|
@ -136,9 +136,9 @@ class RatePlan(Workflow, ModelSQL, ModelView):
|
|||
if not price_list:
|
||||
raise UserError(gettext('hotel.msg_missing_default_price_list'))
|
||||
|
||||
# Here add compute of price_list with variations of Context,
|
||||
# Here add compute of price_list with variations of context,
|
||||
# minima estancia, dia de la semana, desayuno incluido, etc
|
||||
# including occupancy_rate and IA analysis of market
|
||||
# including occupancy_rate, IA analysis, and analysis market
|
||||
return {'id': price_list.id, 'rec_name': price_list.name}
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.128
|
||||
version=6.0.129
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
|
@ -92,16 +92,16 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="vehicles_num"/>
|
||||
<field name="vehicles_num"/>
|
||||
<newline/>
|
||||
<separator name="comments" colspan="4"/>
|
||||
<field name="comments" colspan="4"/>
|
||||
<separator name="notes" colspan="4"/>
|
||||
<field name="notes" colspan="4"/>
|
||||
</page>
|
||||
<page string="Channel Manager" id="channel_manager">
|
||||
<label name="channel_manager"/>
|
||||
<field name="channel_manager"/>
|
||||
<label name="reservation_code"/>
|
||||
<field name="reservation_code"/>
|
||||
<label name="collection_mode"/>
|
||||
<field name="collection_mode"/>
|
||||
<label name="booker"/>
|
||||
<field name="booker"/>
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
<label name="created_channel"/>
|
||||
<field name="created_channel"/>
|
||||
<label name="channel_commission"/>
|
||||
|
|
Loading…
Reference in New Issue