diff --git a/hotel/models/hotel_folio.py b/hotel/models/hotel_folio.py index ed88c0073..a121a1a96 100644 --- a/hotel/models/hotel_folio.py +++ b/hotel/models/hotel_folio.py @@ -856,3 +856,32 @@ class HotelFolio(models.Model): info_grouped.append(vals) return sorted(sorted(info_grouped,key=lambda k: k['num'], reverse=True), key=lambda k: k['room_type']['id']) + + @api.multi + def _get_tax_amount_by_group(self): + self.ensure_one() + res = {} + for line in self.room_lines: + price_reduce = line.price_total + product = line.room_type_id.product_id + taxes = line.tax_ids.compute_all(price_reduce, quantity=1, product=product)['taxes'] + for tax in line.tax_ids: + group = tax.tax_group_id + res.setdefault(group, {'amount': 0.0, 'base': 0.0}) + for t in taxes: + if t['id'] == tax.id or t['id'] in tax.children_tax_ids.ids: + res[group]['amount'] += t['amount'] + res[group]['base'] += t['base'] + for line in self.service_ids: + price_reduce = line.price_unit * (1.0 - line.discount / 100.0) + taxes = line.tax_ids.compute_all(price_reduce, quantity=line.product_qty, product=line.product_id)['taxes'] + for tax in line.tax_ids: + group = tax.tax_group_id + res.setdefault(group, {'amount': 0.0, 'base': 0.0}) + for t in taxes: + if t['id'] == tax.id or t['id'] in tax.children_tax_ids.ids: + res[group]['amount'] += t['amount'] + res[group]['base'] += t['base'] + res = sorted(res.items(), key=lambda l: l[0].sequence) + res = [(l[0].name, l[1]['amount'], l[1]['base'], len(res)) for l in res] + return res diff --git a/hotel/models/hotel_reservation.py b/hotel/models/hotel_reservation.py index 5875311f3..5d77915a8 100644 --- a/hotel/models/hotel_reservation.py +++ b/hotel/models/hotel_reservation.py @@ -295,6 +295,7 @@ class HotelReservation(models.Model): has_checkout_to_send = fields.Boolean( related='folio_id.has_checkout_to_send', readonly=True) + to_print = fields.Boolean('Print', help='Print in Folio Report', default=True) # order_line = fields.One2many('sale.order.line', 'order_id', string='Order Lines', states={'cancel': [('readonly', True)], 'done': [('readonly', True)]}, copy=True, auto_join=True) # product_id = fields.Many2one('product.product', related='order_line.product_id', string='Product') # product_uom = fields.Many2one('product.uom', string='Unit of Measure', required=True) @@ -302,10 +303,11 @@ class HotelReservation(models.Model): related='pricelist_id.currency_id', string='Currency', readonly=True, required=True) invoice_status = fields.Selection([ - ('invoiced', 'Fully Invoiced'), - ('to invoice', 'To Invoice'), - ('no', 'Nothing to Invoice') - ], string='Invoice Status', compute='_compute_invoice_status', store=True, readonly=True, default='no') + ('invoiced', 'Fully Invoiced'), + ('to invoice', 'To Invoice'), + ('no', 'Nothing to Invoice') + ], string='Invoice Status', compute='_compute_invoice_status', + store=True, readonly=True, default='no') tax_ids = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)]) @@ -741,7 +743,7 @@ class HotelReservation(models.Model): def onchange_room_availabiltiy_domain(self): self.ensure_one() if self.checkin and self.checkout: - if self.overbooking or self.reselling or self.state in ('cancelled'): + if self.overbooking or self.reselling: return occupied = self.env['hotel.reservation'].get_reservations( self.checkin, @@ -1094,7 +1096,7 @@ class HotelReservation(models.Model): @api.model def _get_domain_reservations_occupation(self, dfrom, dto): #WARNING If add or remove domain items, update _hcalendar_get_count_reservations_json_data - # in calendar module hotel_calendar_management.py + # in calendar module hotel_calendar domain = [('reservation_line_ids.date', '>=', dfrom), ('reservation_line_ids.date', '<=', dto), ('state', '!=', 'cancelled'), @@ -1141,9 +1143,7 @@ class HotelReservation(models.Model): if fields.Date.from_string(self.checkin) >= fields.Date.from_string(self.checkout): raise ValidationError(_('Room line Check In Date Should be \ less than the Check Out Date!')) - if not self.overbooking \ - and self.state not in ('cancelled') \ - and not self._context.get("ignore_avail_restrictions", False): + if not self.overbooking and not self._context.get("ignore_avail_restrictions", False): occupied = self.env['hotel.reservation'].get_reservations( self.checkin, (fields.Date.from_string(self.checkout) - timedelta(days=1)). diff --git a/hotel/models/hotel_service.py b/hotel/models/hotel_service.py index 03bf5831b..e51f2e3df 100644 --- a/hotel/models/hotel_service.py +++ b/hotel/models/hotel_service.py @@ -127,6 +127,7 @@ class HotelService(models.Model): product_qty = fields.Integer('Quantity', default=1) days_qty = fields.Integer(compute="_compute_days_qty", store=True) is_board_service = fields.Boolean() + to_print = fields.Boolean('Print', help='Print in Folio Report') # Non-stored related field to allow portal user to see the image of the product he has ordered product_image = fields.Binary('Product Image', related="product_id.image", store=False, related_sudo=True) company_id = fields.Many2one(related='folio_id.company_id', string='Company', store=True, readonly=True) diff --git a/hotel/report/hotel_folio_templates.xml b/hotel/report/hotel_folio_templates.xml index 0ed203b08..c32c715f9 100644 --- a/hotel/report/hotel_folio_templates.xml +++ b/hotel/report/hotel_folio_templates.xml @@ -56,7 +56,6 @@
| Payment Ref. | +Payment Date | +Payment Method | +Paid Amount | +
|---|---|---|---|
| + | + | + | + |
| Return Ref. | +Return Date | +Return Method | +Return Amount | +
|---|---|---|---|
| + | + | + | + |
diff --git a/hotel/views/hotel_reservation_views.xml b/hotel/views/hotel_reservation_views.xml
index 6d95a9518..ad3d8d5a7 100644
--- a/hotel/views/hotel_reservation_views.xml
+++ b/hotel/views/hotel_reservation_views.xml
@@ -437,6 +437,7 @@
decoration-warning="overbooking">