diff --git a/booking.fodt b/booking.fodt index da9a3ca..2516c06 100644 Binary files a/booking.fodt and b/booking.fodt differ diff --git a/booking.py b/booking.py index 9bae371..5698c9e 100644 --- a/booking.py +++ b/booking.py @@ -508,11 +508,14 @@ class Booking(Workflow, ModelSQL, ModelView): for charge in charges: bk = charge.folio.booking - invoice_party_id = charge.invoice_to.id + invoice_party_id = fo.booking.party.id + if charge.invoice_to: + invoice_party_id = charge.invoice_to.id + unit_price = bk.currency.round(charge.unit_price) if invoice_party_id not in res.keys(): res[invoice_party_id] = { - 'party': charge.invoice_to, + 'party': invoice_party_id, 'currency': bk.currency.id, 'payment_term': None, 'number': bk.number, diff --git a/folio.fodt b/folio.fodt index ef73f0d..5bdeed0 100644 Binary files a/folio.fodt and b/folio.fodt differ diff --git a/folio.py b/folio.py index b3b4fae..bbac1e2 100644 --- a/folio.py +++ b/folio.py @@ -222,11 +222,11 @@ class Folio(ModelSQL, ModelView): def check_room(self): Housekeeping = Pool().get('hotel.housekeeping') - hk, = Housekeeping.search([ + rooms = Housekeeping.search([ ('room', '=', self.room.id) ]) - if hk.state != 'clean': - raise UserError(gettext('hotel.msg_room_no_clean', s=hk.room.name)) + if not rooms or rooms[0].state != 'clean': + raise UserError(gettext('hotel.msg_room_no_clean', s=self.room.name)) @classmethod @ModelView.button diff --git a/service.py b/service.py index c972731..f61e518 100644 --- a/service.py +++ b/service.py @@ -238,17 +238,17 @@ class ServiceLine(Workflow, ModelSQL, ModelView): ('room', '=', self.room.id), ('registration_state', '=', 'check_in'), ]) - # if not folios: - # raise UserError( - # gettext('hotel.msg_room_not_occupied', s=self.room.name) - # ) - # elif len(folios) > 1: - # raise UserError( - # gettext('hotel.msg_multiple_rooms_active', s=self.room.name) - # ) - if not folios: - return + raise UserError( + gettext('hotel.msg_room_not_occupied', s=self.room.name) + ) + elif len(folios) > 1: + raise UserError( + gettext('hotel.msg_multiple_rooms_active', s=self.room.name) + ) + + # if not folios: + # return folio = folios[0] new_line = { @@ -257,7 +257,7 @@ class ServiceLine(Workflow, ModelSQL, ModelView): 'order': self.order, 'description': self.description, 'quantity': int(self.quantity), - 'invoice_to': self.folio.main_guest.id, + # 'invoice_to': self.folio.booking.party.id, 'unit_price': self.product.template.list_price, 'product': self.product.id, 'to_invoice': True, @@ -311,7 +311,7 @@ class CreateDailyServices(Wizard): folios = Folio.search([ ('arrival_date', '<', self.start.date), - # ('departure_date', '<', self.start.date), + ('departure_date', '>=', self.start.date), ('registration_state', 'in', ['check_in']), ]) diff --git a/statement.fodt b/statement.fodt index a8ce358..4e4aa7f 100644 Binary files a/statement.fodt and b/statement.fodt differ