From 7194c9e4e733a329197a189f8b23ae81ef25548e Mon Sep 17 00:00:00 2001 From: Alexis Lopez Zubieta Date: Fri, 4 Aug 2023 10:17:54 -0600 Subject: [PATCH] fix: fallback to 0.0 if the input value is empty when parsing decimals --- .../models/account_statement_import_sheet_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py index deee5fd02..4f8ec655f 100644 --- a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py +++ b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py @@ -425,7 +425,9 @@ def _convert_line_to_transactions(self, line): # noqa: C901 @api.model def _parse_decimal(self, value, mapping): - if isinstance(value, Decimal): + if not value: + return Decimal(0.0) + elif isinstance(value, Decimal): return value elif isinstance(value, float): return Decimal(value)