Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solution for wrong vat rate for old invoices #1223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OlegPhenomenon
Copy link
Contributor

@OlegPhenomenon OlegPhenomenon commented Feb 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants