[WIP] Invoice WorkFlow

This commit is contained in:
Dario Lodeiros
2019-01-27 17:38:55 +01:00
parent 4e7e893e79
commit 6820ab8e17
3 changed files with 16 additions and 21 deletions

View File

@@ -20,10 +20,10 @@ class HotelCheckinPartner(models.Model):
def _default_folio_id(self):
if 'folio_id' in self.env.context:
folio = self.env['hotel.folio'].browse([
self.env.context['reservation_id']
self.env.context['folio_id']
])
return folio
raise ValidationError(_('You only can create checkin from reservations or folios'))
return False
def _default_enter_date(self):
if 'reservation_id' in self.env.context:

View File

@@ -97,6 +97,19 @@
<span class="o_stat_text">Books</span>
</div>
</button>
<button type="object" class="oe_stat_button"
id="payment_smart_button"
icon="fa-money"
name="action_pay_folio"
attrs="{'invisible': ['|',('folio_pending_amount','&lt;=',0)]}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value">
<field name="folio_pending_amount" nolabel="1"
widget="monetary" options="{'currency_field': 'currency_id'}"/>
</span>
<span class="o_stat_text">Pending Payment</span>
</div>
</button>
<button type="object" class="oe_stat_button" id="invoice_button"
icon="fa-pencil-square-o" name="open_invoices_reservation">
<div class="o_form_field o_stat_info">

View File

@@ -483,25 +483,7 @@ class HotelReservation(models.Model):
def write(self, vals):
_logger.info("RESERV WRITE")
ret = super(HotelReservation, self).write(vals)
if 'partner_id' in vals or 'checkin' in vals or \
'checkout' in vals or 'product_id' in vals or \
'adults' in vals or 'children' in vals or \
'state' in vals or 'splitted' in vals or \
'closure_reason_id' in vals or 'out_service_description' in vals or \
'reservation_type' in vals or \
'price_total' in vals or \
'parent_reservation' in vals or 'overbooking' in vals or \
'room_type_id' in vals:
for record in self:
record.send_bus_notification(
'write',
(record.state == 'cancelled') and 'warn' or 'notify',
(record.state == 'cancelled')
and _("Reservation Cancelled") or _("Reservation Changed")
)
elif not any(vals) or 'to_read' in vals or 'to_assign' in vals:
self.send_bus_notification('write', 'noshow')
self.send_bus_notification('write', 'noshow')
return ret
@api.multi