Add liability

This commit is contained in:
Maks Snegov 2025-08-13 02:35:16 -07:00
parent 69f08dc4a0
commit 30fd96ff50

17
g2f.py
View File

@ -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