[IMP] Wizard Reservation names and fields

This commit is contained in:
Dario Lodeiros
2019-04-08 20:58:44 +02:00
parent 119e201fc3
commit c0ba659028
2 changed files with 15 additions and 13 deletions

View File

@@ -33,12 +33,14 @@ class HotelService(models.Model):
@api.multi @api.multi
def name_get(self): def name_get(self):
result = [] result = []
for res in self: for rec in self:
name = u'%s (%s)' % (res.name, res.ser_room_line.name) name = []
result.append((res.id, name)) name.append('%(name)s' % {'name': rec.name})
if rec.ser_room_line.name:
name.append('%(name)s' % {'name': rec.ser_room_line.name})
result.append((rec.id, ", ".join(name)))
return result return result
@api.model @api.model
def _default_ser_room_line(self): def _default_ser_room_line(self):
if self.env.context.get('room_lines'): if self.env.context.get('room_lines'):

View File

@@ -298,15 +298,15 @@ class FolioAdvancePaymentInv(models.TransientModel):
lambda x: x.is_board_service == False and \ lambda x: x.is_board_service == False and \
x.qty_to_invoice != 0 and \ x.qty_to_invoice != 0 and \
(x.ser_room_line.id in self.reservation_ids.ids or \ (x.ser_room_line.id in self.reservation_ids.ids or \
x.ser_room_line.id == False)): not x.ser_room_line.id)):
invoice_lines[service.id] = { invoice_lines[service.id] = {
'description' : service.name, 'description' : service.name,
'product_id': service.product_id.id, 'product_id': service.product_id.id,
'qty': service.qty_to_invoice, 'qty': service.qty_to_invoice,
'discount': service.discount, 'discount': service.discount,
'price_unit': service.price_unit, 'price_unit': service.price_unit,
'service_id': service.id, 'service_id': service.id,
} }
for reservation in folio.room_lines.filtered( for reservation in folio.room_lines.filtered(
lambda x: x.id in self.reservation_ids.ids and lambda x: x.id in self.reservation_ids.ids and
x.invoice_status == 'to invoice'): x.invoice_status == 'to invoice'):
@@ -432,7 +432,7 @@ class LineAdvancePaymentInv(models.TransientModel):
for record in self: for record in self:
origin = record.reservation_id if record.reservation_id.id else record.service_id origin = record.reservation_id if record.reservation_id.id else record.service_id
amount_line = record.price_unit * record.qty amount_line = record.price_unit * record.qty
if amount_line > 0: if amount_line != 0:
product = record.product_id product = record.product_id
price = amount_line * (1 - (record.discount or 0.0) * 0.01) price = amount_line * (1 - (record.discount or 0.0) * 0.01)
taxes = origin.tax_ids.compute_all(price, origin.currency_id, 1, product=product) taxes = origin.tax_ids.compute_all(price, origin.currency_id, 1, product=product)