How to Correct the Tax Rate in AR Documents Issued Before You Install CB 20.4.0 HOTFIX PLATFORM v16
Original Publishing Date:
2020-08-28
Symptoms
After you install CB 20.4.0 HOTFIX PLATFORM v16 and change a tax rate for the necessary period, there may be already issued AR documents in which the tax rate must also be changed. For example, you may install the hotfix after the locally required tax rate reductions are already in effect. As a result, corrections must be made to the already issued AR documents.
Resolution
To make corrections to tax rates in AR documents issued the HF installation, please run the vat_correction.py script.
The script corrects:
- invoices
- credit memos issued automatically to refund for subscription cancellations.
The script does not correct:
- credit and debit memos issued manually.
NOTE: The script vat_correction.py is intended to handle a temporary economic relief measure which was a temporary reduction in Value Added Tax (VAT) from 19% to 16% in Germany for the period from 1 July 2020 till 31 December 2020. It should not be used for other purposes.
Corrections are made in the following way:
- To correct an invoice, the script will create the following documents:
- a reverting document – a credit memo with all the details from the original invoice but with the negative sign.
- a correction document – an invoice where all the details are re-calculated according to the relevant tax configuration.
- To correct a credit memo, the script will create the following documents:
- a reverting document – an invoice with all the details from the original credit memo but with the negative sign.
- a correction document – credit memo where all the details are re-calculated according to the relevant tax configuration.
For each reverting and each correction document, the script adds the following description, a localizable string: “VAT rate correction”. If you need this phrase to be displayed in the language of an invoice, you can localize it to that language.
The script uses the current tax configuration to check tax values in invoices. To ensure the correct output, make sure that taxes are configured properly.
Execution
Run the script on the Billing Application node.
Run Modes
The script can be run in two modes:
- Test (DryRun) mode: In this mode, the script does not make changes in the database. Use this mode for testing.
- Commit mode: In this mode, the script performs corrections (creates the reverting and correction documents). The script does not change the original documents.
Result
After each run, the script creates a csv file with results. The file name includes resellerID_mode(fix/dry)_currentdate(timestamp).
The csv file contains the following columns:
- reseller ID: The ID of the reseller for which the script was run (see Run Options)
- original document date
- original document number
- change order ID
- reverting document date: The date on which the script is run (empty for the test mode).
- reverting document number (empty for the test mode)
- correct document date: The date on which the script is run (empty for the test mode).
- correct document number (empty for the test mode)
- detail description: Details are the same for all 3 documents: the original, the reverting, and the correction
- detail end date (empty if empty in the original document)
- detail original extended price
- detail original tax value
- detail correct extended price
- detail correct tax value
Run Options
You can run the script:
- for an individual document
- for a reseller for a given period
Usage
python vat_correction.py [ResellerID] [StartDate] [DryMode]
or
python vat_correction.py [DocID] [DryMode]
For example:
- The following execution will find all incorrect invoices created for all accounts under the reseller with ID=12345 starting from August 01, 2020. DryMode = 1 means that DryMode is on: the script does not write any changes to the database.
python vat_correction.py 12345 2020-08-01 1
- The following execution will correct all incorrect invoices created for all accounts under the reseller with ID=12345 starting from July 01, 2019. DryMode = 0 means that DryMode is off: the script writes all the changes to the database.
python vat_correction.py 12345 2019-07-01 0
Reiterability
The script creates a tmp DB table TmpDocWithFixedTaxes with the following structure:
- Original_DocID
- Correcting_DocID
- Reverting_DocID
- Order_ID
For script reiterability, the script uses this table to save information about processed AR Documents. You may remove this table after correction is performed.