From 7302ad8c364ff10bc3f5b05d910bd2679c3b167d Mon Sep 17 00:00:00 2001 From: Stin <> Date: Sat, 11 Apr 2020 14:16:45 -0700 Subject: [PATCH] Recalculate unitprice if missing --- beancount_import/source/ofx.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beancount_import/source/ofx.py b/beancount_import/source/ofx.py index 222b36fa..e885c286 100644 --- a/beancount_import/source/ofx.py +++ b/beancount_import/source/ofx.py @@ -902,8 +902,8 @@ def get_subaccount_cash(inv401ksource: Optional[str] = None) -> str: if quantity_round_digits is not None: units = round(units, quantity_round_digits) - if raw.unitprice==ZERO: - # Assume Zero unitprice is a bug, recalculate. + if raw.unitprice==ZERO or raw.unitprice is None: + # Assume Zero or missing unitprice is a bug, recalculate. unitprice = abs(raw.total/raw.units) else: unitprice = raw.unitprice