Fix
This commit is contained in:
parent
737448d658
commit
b619e84704
19
booking.py
19
booking.py
|
@ -997,13 +997,15 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
Folio = pool.get('hotel.folio')
|
||||
Party = pool.get('party.party')
|
||||
Config = pool.get('hotel.configuration')
|
||||
FolioCharge = pool.get('hotel.folio.charge')
|
||||
Invoice = pool.get('account.invoice')
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
bookings = cls.browse([booking_id])
|
||||
folios = Folio.browse(folios_ids)
|
||||
for folio in folios:
|
||||
folio.add_charge_occupancy(ctx='invoice')
|
||||
invoice = {}
|
||||
invoices = []
|
||||
party = Party(party_id)
|
||||
|
||||
invoice_to_create = cls.get_grouped_invoices(
|
||||
|
@ -1015,7 +1017,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
invoice = cls._get_new_invoice(rec)
|
||||
invoice.on_change_invoice_type()
|
||||
invoice.save()
|
||||
|
||||
invoices.append(invoice)
|
||||
for _line in rec['lines']:
|
||||
line, = InvoiceLine.create([
|
||||
cls._get_invoice_line(invoice, _line)
|
||||
|
@ -1023,10 +1025,23 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
FolioCharge.write([_line.get('charge')], {
|
||||
'invoice_line': line.id,
|
||||
})
|
||||
|
||||
# ################# only for tests ##################
|
||||
# invoice.invoice_type = 'P'
|
||||
# ###################################################
|
||||
invoice.save()
|
||||
invoice.update_taxes([invoice])
|
||||
Booking.concile_charges(bookings)
|
||||
Booking.check_finished(bookings)
|
||||
config = Config.get_configuration()
|
||||
if config.auto_invoice == 'validate_send':
|
||||
Invoice.validate_invoice(invoices)
|
||||
for invoice in invoices:
|
||||
if invoice.invoice_type == 'P':
|
||||
# Invoice.post([invoice])
|
||||
pass
|
||||
elif invoice.invoice_type == '1':
|
||||
Invoice.submit([invoice])
|
||||
|
||||
def get_link_web_checkin(self, name=None):
|
||||
transaction = Transaction().context
|
||||
|
|
2
party.py
2
party.py
|
@ -30,7 +30,7 @@ class Party(metaclass=PoolMeta):
|
|||
def _set_account_defaults(cls, value):
|
||||
ObligationFiscal = Pool().get('party.obligation_fiscal')
|
||||
type_document = value.get('type_document')
|
||||
if type_document == '31': # Is Nights
|
||||
if type_document == '31':
|
||||
regime_tax = 'regimen_responsable'
|
||||
type_person = 'persona_juridica'
|
||||
fiscal_regimen = '48'
|
||||
|
|
Loading…
Reference in New Issue