Update es

This commit is contained in:
oscar alvarez 2022-08-04 08:33:47 -05:00
parent 394074c52d
commit 42850d3cd6
2 changed files with 385 additions and 366 deletions

View File

@ -425,7 +425,6 @@ class Booking(Workflow, ModelSQL, ModelView):
@ModelView.button
@Workflow.transition('confirmed')
def confirm(cls, records):
cls.set_number(records)
for rec in records:
# FIXME check if does not exist previous occupancy if exist update state
rec.update_folio('pending')
@ -594,7 +593,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'currency': bk.currency.id,
'payment_term': bk.payment_term,
'number': bk.number,
'guests_qty': len(fo.guests) + 1,
'guests_qty': len(fo.guests),
'reference': reference,
'agent': agent_id,
'rooms': fo.room.name,
@ -609,6 +608,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'quantity': fo.nights_quantity,
'product': fo.product,
'unit_price': fo.unit_price,
'taxes': fo.taxes,
'origin': str(bk),
'taxes_exception': bk.taxes_exception,
}]
@ -621,20 +621,19 @@ class Booking(Workflow, ModelSQL, ModelView):
'quantity': fo.nights_quantity,
'product': fo.product,
'unit_price': fo.unit_price,
'taxes': fo.taxes,
'origin': str(bk),
'taxes_exception': bk.taxes_exception,
})
for charge in charges:
bk = charge.folio.booking
invoice_party = fo.booking.party
if charge.invoice_to:
invoice_party = charge.invoice_to
invoice_party = charge.invoice_to or bk.party
invoice_party_id = invoice_party.id
unit_price = bk.currency.round(charge.unit_price)
if invoice_party_id not in res.keys():
res[invoice_party.id] = {
res[invoice_party_id] = {
'party': invoice_party,
'currency': bk.currency.id,
'payment_term': bk.payment_term,
@ -654,6 +653,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'unit_price': unit_price,
'charge': charge,
'origin': str(bk),
'taxes': charge.folio.taxes,
'taxes_exception': bk.taxes_exception,
})
return res
@ -672,12 +672,13 @@ class Booking(Workflow, ModelSQL, ModelView):
'product': product.id,
'party': invoice.party.id,
'description': line['description'],
'taxes': line['taxes'],
'origin': line['origin'],
}
if not line['taxes_exception']:
taxes_ids = cls.get_taxes(line['product'], invoice.party, invoice.currency)
if taxes_ids:
new_line.update({'taxes': [('add', taxes_ids)]})
# if not line['taxes_exception']:
# taxes_ids = cls.get_taxes(line['product'], invoice.party, invoice.currency)
# if taxes_ids:
# new_line.update({'taxes': [('add', taxes_ids)]})
return new_line
def do_moves(self):
@ -870,6 +871,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'quantity': rec['guests_qty'],
'unit_price': product.template.list_price,
'product': product.id,
'taxes': rec['taxes'],
'description': product.rec_name,
'origin': str(self),
}
@ -911,8 +913,9 @@ class Booking(Workflow, ModelSQL, ModelView):
company_id = Transaction().context.get('company')
party = data['party']
# party is instance or id fixme
if type(party) == int:
party = Party(party)
# if type(party) == int:
# party = Party(party)
ota_code = data.get('ota_booking_code', '')
if data.get('description'):
description = data['description']

File diff suppressed because it is too large Load Diff