Allow a wealth tax threshold of zero
This commit is contained in:
1 parent
7a0423307a
commit
b6b82a54ba
1 file changed
+16
-4
+16
-4
@@ -377,11 +377,23 @@ def validate_settings(payload):
|
|||||||
settings[key] = str(flag)
|
settings[key] = str(flag)
|
||||||
|
|
||||||
if "wealth_tax_threshold_ore" in data:
|
if "wealth_tax_threshold_ore" in data:
|
||||||
ore, error = validate_ore(data["wealth_tax_threshold_ore"], optional=True)
|
text = str(data["wealth_tax_threshold_ore"] or "").strip()
|
||||||
if error:
|
if not text:
|
||||||
errors["wealth_tax_threshold_ore"] = error
|
settings["wealth_tax_threshold_ore"] = "0"
|
||||||
else:
|
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:
|
if "year_end_price_source" in data:
|
||||||
settings["year_end_price_source"] = str(data["year_end_price_source"]).strip()
|
settings["year_end_price_source"] = str(data["year_end_price_source"]).strip()
|
||||||
|
|||||||
Reference in new issue
Block a user