solution for wrong vat rate for old invoices #1223
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR relates to this task #1222 . The essence is that old invoices that were created before the year 2024 and have the country code Estonia in the billing profile change to the wrong VAT rate after payment in the current year. It turns out that the user pays at a VAT rate of 20 percent, but after payment, the invoice is marked as though it was paid at 22 percent, which creates confusion for accounting.
However, there is another problem, if, say, a user has an old unpaid invoice from the year 2023 and they decide to change the billing profile for this invoice, a VAT rate of 22 percent will be set if the billing profile has the country code of Estonia - this is also incorrect. This PR solves these two problems.
But what about invoices that already have incorrect data?
For this, you need to run the task
rake invoices:assign_values_to_old_invoices
. This task takes all invoices that were created before the year 2024, which have the country code Estonia and which have a VAT rate of 22 percent, it changes the VAT rate to 20 percent, and also setsin_directo = false
. The directo task will have to be run manually.How to test?
rake invoices:assign_values_to_old_invoices
and check the result.