Allow a wealth tax threshold of zero

This commit is contained in:
ai-bot committed 2026-11-14 16:18:55 +00:00
1 parent 7a0423307a
commit b6b82a54ba
1 file changed
+16 -4
+16 -4
View File
@@ -377,11 +377,23 @@ def validate_settings(payload):
settings[key] = str(flag)
if "wealth_tax_threshold_ore" in data:
ore, error = validate_ore(data["wealth_tax_threshold_ore"], optional=True)
if error:
errors["wealth_tax_threshold_ore"] = error
text = str(data["wealth_tax_threshold_ore"] or "").strip()
if not text:
settings["wealth_tax_threshold_ore"] = "0"
else:
settings["wealth_tax_threshold_ore"] = str(ore or 0)
try:
ore = rates.nok_to_ore(text)
except ValueError as error:
errors["wealth_tax_threshold_ore"] = (
"Beløp kan ha høgst 2 desimalar."
if "2 decimals" in str(error)
else "Beløp må vere eit tal, t.d. 1 000 000."
)
else:
if ore < 0:
errors["wealth_tax_threshold_ore"] = "Botnen kan ikkje vere negativ."
else:
settings["wealth_tax_threshold_ore"] = str(ore)
if "year_end_price_source" in data:
settings["year_end_price_source"] = str(data["year_end_price_source"]).strip()