tuttle-dev/tuttle

UI bug: Invoice "not rendered" even though PDF exists

clstaudt opened this issue · 4 comments

Image

To reproduce:

  1. create a new invoice
  2. click "View" to preview the PDF

this works ✅

  1. reload the invoicing screen
  2. click "View" on the same invoice

❌ this fails with "invoice has not been rendered" message in the snack bar

@vlad-ed-git Please have a look. If it's a backend issue pass the ticket to me.

@clstaudt It's a backend issue. And I think I know what it is. We save the invoice, render it, update it's rendered property, and never save it again. Perhaps we should render it and then save?

see create_invoice intent (under Invoicing). The call self._invoicing_data_source.save_invoice(invoice) is done before rendering the invoice. I think this would cause this bug (and also the #177 issue as well). Because there is a discrepancy between the object stored in memory and the one stored in the database.

@clstaudt I moved the save line to after rendering. And I am not getting any errors now.

@vlad-ed-git good catch, it's working