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 sets in_directo = false. The directo task will have to be run manually.
How to test?
First, you need to try to reproduce the errors, how this can be done:
Finish an auction and generate an invoice - then you need to change the values (issue_date, due_date, created_at, vat_rate) to last year's in this invoice and try to pay it, after that check what the values of the invoices are now.
You also need to try to simply pay a regular invoice to make sure that the changes didn’t spoil anything.
You also need to generate an invoice with last year's values for (issue_date, due_date, created_at, vat_rate) and for this invoice change the billing profile, for example, from foreign to Estonian, and make sure that for the Estonian billing profile VAT rate = 20%.
You also need to generate an invoice with last year's values for (issue_date, due_date, created_at, vat_rate), however, set the VAT rate value to 22 percent and change in_directo to true, then run the task rake invoices:assign_values_to_old_invoices and check the result.
After running the above task, make sure that this task did not affect other invoices that were created in the current year.
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.