Bug 31984

Summary: TaxRate system preference - add note about updating vendor tax rates where required
Product: Koha Reporter: David Nind <david>
Component: AcquisitionsAssignee: David Nind <david>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: jacob.omara
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement adds a note to the TaxRates system preference about updating vendors tax rates when the TaxRates system preference values are changed or removed. (Vendors retain the original value entered, and this is used to calculate the tax rate for orders.)
Version(s) released in:
23.05.00,22.11.01
Circulation function:
Attachments: Screenshot - tax rate field for order form (with custom values)
Screenshot - Receiving order - formatting and default values
Bug 31984: TaxRate preference - add note about vendor updates
Bug 31984: TaxRate preference - add note about vendor updates
Bug 31984: TaxRate preference - add note about vendor updates

Description David Nind 2022-10-26 02:34:21 UTC
For the TaxRate system preference:

1. The description [1] says that the first value entered will be used by default.

2. When entering an order for a basket, the last value in the list is selected as the default (19.65%).

3. If the values for the TaxRate system preference are changed, for example having the values: 0.15|0.20:
   - 19.65% is shown as the default value, even though it is not a value entered in the TaxRate system preference
   - There is a warning for the 'Tax rate' input field for the order: "Tax rate not defined in system preference TaxRates!"
   - The tax inclusive values for budgets/funds are calculated correctly if you choose another option, despite the warning message.

To replicate:
1. Check that there are values entered for the TaxRates system preference (in KTD the values entered are: 0|0.12|0.1965).
2. Create a new basket (or use an existing one).
3. Add a new order to the basket.
4. On the accounting details form, note that the default value for the 'Tax rate' field is 19.65% and the other options are 0% and 12%.
5. Complete adding the order to the basket.
6. On the acquisitions home page, note that the ordered amount is tax inclusive and is calculated correctly.
7. Change the TaxRates system preference to: 0.15|0.20
8. Repeat steps 2-3.
9. Note that on the accounting details form for the 'Tax rate' field:
   . the options available are 15%, 20%, and 19.65%, with the 19.65% shown as the default - even though 19.65% is not a value entered for the system preference
   . there is a warning for the field: "Tax rate not defined in system preference TaxRates!"
10. Select the 15% option, and repeat steps 5-6. The tax inclusive amount is correctly calculated, despite the warning that was on the form.

[1] Current description in master, with default values used in KTD:
Tax rates are [0|0.12|0.1965]. Enter in numeric form, 0.12 for 12%. The first item in the list will be selected by default. For more than one value, separate with | (pipe). Please note: The database will only accept values up to 4 decimals precision, further values will be rounded.
Comment 1 David Nind 2022-10-26 02:41:27 UTC
Created attachment 142659 [details]
Screenshot - tax rate field for order form (with custom values)

A screenshot showing the accounting details form for an order, where 15% and 20% values are entered into the TaxRate system preference (0.15|0.20).

Note that 19.65% is selected by default, even though it is not a value entered into the TaxRate system preference.
Comment 2 David Nind 2022-10-26 02:42:43 UTC
(In reply to David Nind from comment #1)
> Created attachment 142659 [details]

Also note the warning message.
Comment 3 David Nind 2022-10-26 02:54:07 UTC Comment hidden (obsolete)
Comment 4 David Nind 2022-10-26 02:57:02 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2022-11-17 09:26:20 UTC
Either the pref or the behavior is certainly wrong! Confirmed on current master that the last value of taxrate is selected instead of the first as documented.
Comment 6 David Nind 2022-11-17 12:25:00 UTC
Worked out that the 19.65 is coming from the vendor information:
1. Check "My Vendor" - tax rate is set to 19.65% - drop down list has values from TaxRates.
2. Change TaxRates, for example: from 0|0.12|0.1965 to 0|0.12|0.15
3. Vendor tax rate remains as 19.65 until you edit the vendor (when editing will default to 0%).
Comment 7 Katrin Fischer 2022-11-17 12:27:25 UTC
(In reply to David Nind from comment #6)
> Worked out that the 19.65 is coming from the vendor information:
> 1. Check "My Vendor" - tax rate is set to 19.65% - drop down list has values
> from TaxRates.
> 2. Change TaxRates, for example: from 0|0.12|0.1965 to 0|0.12|0.15
> 3. Vendor tax rate remains as 19.65 until you edit the vendor (when editing
> will default to 0%).

Ok, that makes sense.

When you create a new vendor, the first is selected correctly.

So is this ok after all?
Comment 8 David Nind 2022-11-17 12:45:01 UTC
(In reply to Katrin Fischer from comment #7)

> Ok, that makes sense.
> 
> When you create a new vendor, the first is selected correctly.
> 
> So is this ok after all?

It makes sense.

But should there be a warning somewhere?

Either (or both):

- For the TaxRates system preference to say that vendor information may need updating if you remove existing values (for example, "NOTE: Current vendor information may need updating if existing tax rates values are removed.")

- For the warning on the order to say something along the lines of "vendor tax rate needs updating" (Possibly "The tax rate for the vendor does not match any values in the TaxRates system preference - please update the information for this vendor."
Comment 9 Katrin Fischer 2022-11-17 12:50:44 UTC
To me the warning is ok as is, but I think adding to the pref might be helpful.
Comment 10 David Nind 2022-11-17 13:04:00 UTC
(In reply to Katrin Fischer from comment #9)
> To me the warning is ok as is, but I think adding to the pref might be
> helpful.

Have assigned to myself - I think I can manage changing the text for the system preference.
Comment 11 David Nind 2022-11-28 13:38:20 UTC
Created attachment 144282 [details] [review]
Bug 31984: TaxRate preference - add note about vendor updates

If a value for the TaxRates system preference is changed or
removed, vendors retain the original value recorded in their
tax rate field.

The vendor tax rate is used to calculate prices for orders
added to a basket. Where the tax rate doesn't match with the
system preference, a warning message is displayed on the order
form "Tax rate not defined in system preference TaxRates!".

This patch adds a note to the system preference description
about updating vendor tax rate information where required.

Test plan:
1. Check the values recorded for the TaxRates system preference.
2. For a vendor (Acquisitions > search for a vendor > Edit vendor),
   check the value recorded in the tax rate field.
3. Note that the tax rate field is populated from a dropdown list
   using values from the TaxRates system preference.
4. Change the TaxRates system preferemce to remove a tax
   rate. For example, change 0|0.12|0.1965 to 0|0.12.
5. Refresh the vendor page.
6. Note that the vendor tax rate remains as the original value
   until you edit the vendor.
7. Apply the patch.
8. Review the description for the TaxRates system preference and
   make sure the new note about updating vendor tax rates where
   required makes sense.
9. Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Lucas Gass (lukeg) 2022-11-28 17:57:19 UTC
Created attachment 144303 [details] [review]
Bug 31984: TaxRate preference - add note about vendor updates

If a value for the TaxRates system preference is changed or
removed, vendors retain the original value recorded in their
tax rate field.

The vendor tax rate is used to calculate prices for orders
added to a basket. Where the tax rate doesn't match with the
system preference, a warning message is displayed on the order
form "Tax rate not defined in system preference TaxRates!".

This patch adds a note to the system preference description
about updating vendor tax rate information where required.

Test plan:
1. Check the values recorded for the TaxRates system preference.
2. For a vendor (Acquisitions > search for a vendor > Edit vendor),
   check the value recorded in the tax rate field.
3. Note that the tax rate field is populated from a dropdown list
   using values from the TaxRates system preference.
4. Change the TaxRates system preferemce to remove a tax
   rate. For example, change 0|0.12|0.1965 to 0|0.12.
5. Refresh the vendor page.
6. Note that the vendor tax rate remains as the original value
   until you edit the vendor.
7. Apply the patch.
8. Review the description for the TaxRates system preference and
   make sure the new note about updating vendor tax rates where
   required makes sense.
9. Sign off!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 13 Tomás Cohen Arazi (tcohen) 2022-12-07 17:24:01 UTC
Created attachment 144479 [details] [review]
Bug 31984: TaxRate preference - add note about vendor updates

If a value for the TaxRates system preference is changed or
removed, vendors retain the original value recorded in their
tax rate field.

The vendor tax rate is used to calculate prices for orders
added to a basket. Where the tax rate doesn't match with the
system preference, a warning message is displayed on the order
form "Tax rate not defined in system preference TaxRates!".

This patch adds a note to the system preference description
about updating vendor tax rate information where required.

Test plan:
1. Check the values recorded for the TaxRates system preference.
2. For a vendor (Acquisitions > search for a vendor > Edit vendor),
   check the value recorded in the tax rate field.
3. Note that the tax rate field is populated from a dropdown list
   using values from the TaxRates system preference.
4. Change the TaxRates system preferemce to remove a tax
   rate. For example, change 0|0.12|0.1965 to 0|0.12.
5. Refresh the vendor page.
6. Note that the vendor tax rate remains as the original value
   until you edit the vendor.
7. Apply the patch.
8. Review the description for the TaxRates system preference and
   make sure the new note about updating vendor tax rates where
   required makes sense.
9. Sign off!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Tomás Cohen Arazi (tcohen) 2022-12-07 17:30:46 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 15 Jacob O'Mara 2022-12-08 11:11:19 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.