Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Add financial year documents filter #256

Conversation

ddddavidmartin
Copy link
Contributor

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.

screen shot 2017-08-26 at 8 05 03 pm

Thanks!

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.
@ddddavidmartin
Copy link
Contributor Author

I haven't looked at implementing tests for this yet, mostly as I'm not quite sure where to begin I reckon.

@thomasbrueggemann
Copy link
Contributor

I also use paperless for managing my financial documents, but use tags for this.
I assign those documents tags such as "tax-2017-Q1".
Might be a usecase for you too, instead of baking specialty functionality into the otherwise quite generic paperless? Just an idea.

@ddddavidmartin
Copy link
Contributor Author

Hmmm, you are making a good point there @thomasbrueggemann. You can't do quarters easily with that filter for example.

My thought process:

  • Paperless does not support applying tags for a range of dates, it only matches by content. As a consequence I would have to tag all my documents by hand, right?
  • A financial year is just a range of days in a year, and all documents by default have a date. So you get that categorisation into the specific financial years basically for free. I do use tags to mark documents for taxes and specific projects in general though.
  • The financial year filter is not active unless it is set in the config.

@ddddavidmartin
Copy link
Contributor Author

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. :)

@danielquinn
Copy link
Collaborator

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?

@danielquinn
Copy link
Collaborator

Also, hello from Ιος!

ios

@ddddavidmartin
Copy link
Contributor Author

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.

@danielquinn danielquinn merged commit 09e1b50 into the-paperless-project:master Jan 21, 2018
@ddddavidmartin ddddavidmartin deleted the add_financial_year_filter branch March 24, 2018 08:05
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants