MyFinances icon indicating copy to clipboard operation
MyFinances copied to clipboard

idea: invoice change history

Open TreyWW opened this issue 1 year ago • 7 comments

How big is this feature?

Small

Describe the problem

At the moment if a user changes something, apart from possibly an audit log, you can't recover it. It may be nice to have a version history of invoices when users change things. Even a table of audit logs, with the ability to "go back to" via a button.

awaiting more details, feel free to chip in!

Describe a possible solution

No response

TreyWW avatar Sep 29 '24 14:09 TreyWW

Hello, I would like solve this issue.

tomasandrejdes avatar Oct 08 '24 12:10 tomasandrejdes

Hi @tomasandrejdes,

That's fine, may I just ask that you update the issue as you do research/any reviews of the code before you start making changes?

E.g documenting a possible solution, diagrams if easier, model structure, etc.

May I also ask for an ETA when this can be started? Just helps keep it organised. Otherwise we get old issues with no progress.

Thanks!

TreyWW avatar Oct 08 '24 12:10 TreyWW

Hi, I plan to start in the following days. I will write here with my findings and potential solutions.

tomasandrejdes avatar Oct 09 '24 14:10 tomasandrejdes

Hi, I want to ask, do you have a concrete idea of ​​how you would like it resolved? Do you want the invoice history record to be editable again? Or it is enough that the original record is only for display. Can I create a new table in the database?

tomasandrejdes avatar Oct 29 '24 20:10 tomasandrejdes

Hey @tomasandrejdes,

Yeah the history should basically just store every field. Similar to "Django-simple-history"

But no libraries.

So with this it should be really easy to "go back" to an old version and replace all content.

Yeah a new model will definitely be needed. It may need dynamic fields though and if we change a field it still needs to handle old versions.

Do let me know if you have anything else, more than happy to go over it. If you have discord feel free to DM me, I'm much more active and will respond quicker there.

Thanks!

TreyWW avatar Oct 29 '24 20:10 TreyWW

Thanks for now, I will write when I have discrepancies

tomasandrejdes avatar Oct 29 '24 21:10 tomasandrejdes

Hello, if you want we can switch to discord please send me your name.

I created a new InvoiceHistory model, I store the invoice id, timestamp, record version and a JSON field that should contain all the invoice attributes. I also modified the manage.html template, for the history overview. In the attachment, I am sending a screen of the overview. Snímka obrazovky 2024-10-31 o 9 21 13 Snímka obrazovky 2024-10-31 o 14 47 09

tomasandrejdes avatar Oct 31 '24 13:10 tomasandrejdes