internetee / auction_center

Estonian Internet Foundation's software for auctioning domain names
Other
6 stars 4 forks source link

solution for wrong vat rate for old invoices #1223

Open OlegPhenomenon opened 7 months ago

OlegPhenomenon commented 7 months ago

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?