tuttle-dev / tuttle

🪰 Tuttle - time and money management for freelancers
GNU General Public License v3.0
61 stars 12 forks source link

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

Closed clstaudt closed 1 year ago

clstaudt commented 1 year ago

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

clstaudt commented 1 year ago

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

vlad-ed-git commented 1 year ago

@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.

vlad-ed-git commented 1 year ago

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

clstaudt commented 1 year ago

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