diff --git a/cash_daily_report/wizard/cash_daily_report.py b/cash_daily_report/wizard/cash_daily_report.py index 4bcc6c2f8..23662b940 100644 --- a/cash_daily_report/wizard/cash_daily_report.py +++ b/cash_daily_report/wizard/cash_daily_report.py @@ -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) diff --git a/hotel_channel_connector/models/product_pricelist_item/common.py b/hotel_channel_connector/models/product_pricelist_item/common.py index 27741959d..8136414df 100644 --- a/hotel_channel_connector/models/product_pricelist_item/common.py +++ b/hotel_channel_connector/models/product_pricelist_item/common.py @@ -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) diff --git a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py index 1f6b48ef6..e507f62bb 100644 --- a/hotel_channel_connector_wubook/models/hotel_reservation/importer.py +++ b/hotel_channel_connector_wubook/models/hotel_reservation/importer.py @@ -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 diff --git a/hotel_roommatik/__manifest__.py b/hotel_roommatik/__manifest__.py index 72dfa5e6e..30719f197 100755 --- a/hotel_roommatik/__manifest__.py +++ b/hotel_roommatik/__manifest__.py @@ -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' diff --git a/hotel_roommatik/models/inherited_res_partner.py b/hotel_roommatik/models/inherited_res_partner.py index e8a48b0bf..c806401da 100755 --- a/hotel_roommatik/models/inherited_res_partner.py +++ b/hotel_roommatik/models/inherited_res_partner.py @@ -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'] = {