From 30fd96ff50088ea8968b457f38921ee8c2c4f3f0 Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Wed, 13 Aug 2025 02:35:16 -0700 Subject: [PATCH] Add liability --- g2f.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/g2f.py b/g2f.py index 059de72..4f43f43 100644 --- a/g2f.py +++ b/g2f.py @@ -355,6 +355,23 @@ class GnuCashToFireflyMigrator: else: account_data["account_role"] = "defaultAsset" # default fallback + # add required fields for liability accounts + elif firefly_type == "liability": + # liability_type - mandatory when type is liability + if account.type in ["LOAN"] or "loan" in account.name.lower(): + account_data["liability_type"] = "loan" + elif "mortgage" in account.fullname.lower(): + account_data["liability_type"] = "mortgage" + else: + account_data["liability_type"] = "debt" # default for credit cards, etc. + + # liability_direction - required by API + # "debit" means you owe the debt (most common case) + account_data["liability_direction"] = "debit" + + # interest - mandatory when type is liability, defaults to "0" + account_data["interest"] = "0" + if account.code: account_data["account_number"] = account.code