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

This commit is contained in:
Dario Lodeiros
2019-09-24 11:32:33 +02:00
5 changed files with 17 additions and 11 deletions

View File

@@ -49,11 +49,11 @@ class CashDailyReportWizard(models.TransientModel):
@api.model
@api.model
def _get_default_date_start(self):
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
@api.model
def _get_default_date_end(self):
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
return datetime.datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
date_start = fields.Date("Start Date", default=_get_default_date_start)
date_end = fields.Date("End Date", default=_get_default_date_end)

View File

@@ -55,8 +55,8 @@ class ProductPricelistItem(models.Model):
for record in self:
channel_room_type = self.env['channel.hotel.room.type'].search(
[('product_tmpl_id', '=', record.product_tmpl_id.id)])
if record.fixed_price < channel_room_type.min_price or \
record.fixed_price > channel_room_type.max_price:
if channel_room_type and (record.fixed_price < channel_room_type.min_price or \
record.fixed_price > channel_room_type.max_price):
msg = _("The room type '%s' limits the price between '%s' and '%s'.") \
% (record.name, channel_room_type.min_price, channel_room_type.max_price)
raise ValidationError(msg)

View File

@@ -148,7 +148,7 @@ class HotelReservationImporter(Component):
# Parse 'ancyllary' info
if 'ancillary' in broom:
if 'guests' in broom['ancillary']:
persons = broom['ancillary']['guests']
persons = min(broom['ancillary']['guests'], persons)
if 'tax_inclusive' in broom['ancillary'] and not broom['ancillary']['tax_inclusive']:
_logger.info("--- Incoming Reservation without taxes included!")
tax_inclusive = False

View File

@@ -17,9 +17,9 @@
'depends': [
'hotel',
'partner_contact_gender',
'partner_second_lastname',
'partner_contact_birthdate',
'base_iso3166'
'base_iso3166',
'base_location',
],
'data': [
'data/res_users_data.xml'

View File

@@ -68,26 +68,32 @@ class ResPartner(models.Model):
return [False, error_name]
def rm_prepare_customer(self, customer):
zip = self.env['res.better.zip'].search([
('name', 'ilike', customer['Address']['ZipCode'])])
# Check Sex string
if customer['Sex'] not in {'male', 'female'}:
customer['Sex'] = ''
# Check state_id
state = self.env['res.country.state'].search([
('name', 'ilike', customer['Address']['Province'])])
if not state and zip:
state = zip.state_id
country = self.env['res.country'].search([
('code_alpha3', '=', customer['Address']['Country'])])
if not country and zip:
country = zip.country_id
# Create Street2s
street_2 = customer['Address']['House']
street_2 += ' ' + customer['Address']['Flat']
street_2 += ' ' + customer['Address']['Number']
metadata = {
'firstname': customer['FirstName'],
'lastname': customer['LastName1'],
'lastname2': customer['LastName2'],
'lastname': customer['LastName1'] + ' ' + customer['LastName2'],
'lastname2': '',
'birthdate_date': datetime.strptime(
customer['Birthday'], DEFAULT_ROOMMATIK_DATE_FORMAT).date(),
'gender': customer['Sex'],
'zip': customer['Address']['ZipCode'],
'zip': zip,
'city': customer['Address']['City'],
'street': customer['Address']['Street'],
'street2': street_2,
@@ -111,7 +117,7 @@ class ResPartner(models.Model):
response['Id'] = partner.id
response['FirstName'] = partner.firstname
response['LastName1'] = partner.lastname
response['LastName2'] = partner.lastname2
response['LastName2'] = ''
response['Birthday'] = partner.birthdate_date
response['Sex'] = partner.gender
response['Address'] = {