From 2c6237b8629c50ca2fec32844ced1732635fe869 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 14 Nov 2026 18:02:29 +0000 Subject: [PATCH] Convert the admin cost sats to kroner only when the deduction is on --- tax.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tax.py b/tax.py index dafba11..51c4fe5 100644 --- a/tax.py +++ b/tax.py @@ -180,7 +180,13 @@ def report(year, conn=None): gevinst_ore = sum(account["gevinst_ore"] for account in accounts) tap_ore = sum(account["tap_ore"] for account in accounts) brukt_ore = sum(account["brukt_ore"] for account in accounts) - netto_ore = gevinst_ore - tap_ore - (admin_cost_ore if deduct_admin else 0) + # The sats become kroner only when the owner asks for the deduction, and + # at the year-end rate of the tax year (section 3.10). + if deduct_admin: + admin_cost_ore = _round_div(admin_cost_sats * (price or 0), SATS_PER_BTC) + else: + admin_cost_ore = 0 + netto_ore = gevinst_ore - tap_ore - admin_cost_ore skatt_ore = _round_div(max(netto_ore, 0) * tax_rate, 100) if wealth_enabled: formuesskatt_ore = _round_div(