Skip to content

Commit

Permalink
[FIX] account_statement_import_sheet_parser: prevent failing when ban…
Browse files Browse the repository at this point in the history
…k-balance import

Problem: When the import expects to see the Amount field when
the amounts are split into Credit/Debit. Attempting to import
throws the error "Bad file/mapping: 'Amount' is not in list".
this fix sets the relevant fields to False depending on the
type of import selected by the user.
  • Loading branch information
thedon committed Aug 26, 2024
1 parent bf80a2f commit bb67c09
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ def _parse_lines(self, mapping, data_file, currency_code):
[next(csv_or_xlsx) for _i in range(header_line)]
header = [value.strip() for value in next(csv_or_xlsx)]

if mapping.amount_type == "simple_value":
mapping.debit_credit_column = False
mapping.amount_debit_column = False
mapping.amount_debit_column = False
elif mapping.amount_type == "absolute_value":
mapping.amount_column = False
mapping.amount_debit_column = False
mapping.amount_debit_column = False
elif mapping.amount_type == "distinct_credit_debit":
mapping.amount_column = False
mapping.debit_credit_column = False

# NOTE no seria necesario debit_column y credit_column ya que tenemos los
# respectivos campos related
for column_name in self._get_column_names():
Expand Down

0 comments on commit bb67c09

Please sign in to comment.