From 155003dd7d6d32d0568f42f02d4d8d4edc1a483c Mon Sep 17 00:00:00 2001 From: Sufiyan Adhikari Date: Sun, 11 Feb 2024 21:05:42 +0530 Subject: [PATCH] Allow balancing errors upto 5 decimal --- beancount_import/source/generic_importer_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beancount_import/source/generic_importer_source.py b/beancount_import/source/generic_importer_source.py index 51043bd9..b5efe98c 100644 --- a/beancount_import/source/generic_importer_source.py +++ b/beancount_import/source/generic_importer_source.py @@ -147,7 +147,7 @@ def balance_amounts(txn:Transaction)-> None: inventory = SimpleInventory() for posting in txn.postings: inventory += get_weight(convert_costspec_to_cost(posting)) - unbalanced_currencies = [(currency,v) for currency,v in inventory.items() if v!=0] + unbalanced_currencies = [(currency,v) for currency,v in inventory.items() if round(v, 5)!=0] # posting with no units. Usually added by smart_importer or user empty_posting = any([True if p.units is None else False for p in txn.postings]) if unbalanced_currencies and not empty_posting: