Skip to content

Commit

Permalink
fix: fallback to 0.0 if the input value is empty when parsing decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
azubieta committed Aug 4, 2023
1 parent e69c7c3 commit 7194c9e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 429 in account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py

View check run for this annotation

Codecov / codecov/patch

account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py#L429

Added line #L429 was not covered by tests
elif isinstance(value, Decimal):
return value
elif isinstance(value, float):
return Decimal(value)
Expand Down

0 comments on commit 7194c9e

Please sign in to comment.