-
Notifications
You must be signed in to change notification settings - Fork 504
Add financial year documents filter #256
Add financial year documents filter #256
Conversation
For now we simply hardcode the dates for the AU financial years. We simply show a list of financial years and filter the documents accordingly.
Now we allow to filter for any financial year dates. Note that we also only show the financial year filter if the dates are actually set.
This is a lot cleaner than trying to hack around whether or not the FinancialYearFilter is part of the available filters. This way it will show up if there are result for it and the dates are set, and it will not if any of those conditions is not set.
The German financial year for example goes from January to December. In those cases we simply only show the year in the overview.
It either wraps or it does not depending on how it is set in the config. There is no point in determining it again for each document. Instead we simply store it as a member variable the first time we check.
If the financial year is from Jan to Dec there we do not need to determine the start to see which year it falls into.
I haven't looked at implementing tests for this yet, mostly as I'm not quite sure where to begin I reckon. |
I also use paperless for managing my financial documents, but use tags for this. |
Hmmm, you are making a good point there @thomasbrueggemann. You can't do quarters easily with that filter for example. My thought process:
|
One thing that bugs me about the filters is that they iterate through all documents when you open the overview to generate the tables. That just seems wrong but I'm not sure how to avoid it without diving way deeper into it. Tags are much more efficient that way. :) |
Anything that lets users better find their docs sounds good in my book and this code is very clean, so I'm inclined to merge it, but you two seem to be unsure about it. While I like @thomasbrueggemann's idea of just using tag names, I'm not sure it's the best place to track this kind of data unless it's reasonable to say that some documents might contain a date outside a specific financial year whilst still belonging to that year. In that case, the date on the document can't be trusted, so a tag makes sense and this PR doesn't. However, if that's very unlikely, then loading this functionality into tags doesn't make sense since the date alone gives us everything we need and it's already there. So as I'm not one to think much about the concept of a financial year, I'm looking for some advice here. What do you guys think? |
I'm a little bit envious of your views but I'm happy for you to merge it in @danielquinn. :) It may not be a one-fits-all perfect solution as per the discussion but achieving the same with tags looks like more work in the end. |
I'm using Paperless to store my tax documents and being able to filter by financial year is quite handy. So, this pull request brings in support for a financial year filter.
The start and end date must be set in the config but everything else pretty much just works. Both financial years that go from Jan-Dec as well as for example Jul-Jun work.
Thanks!