You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error while importing an XLXS file whith field balance 0 on any row
The error given is "This bank statement file format is not supported. Did you install the Odoo module to support this format?"
This is a generic error typically raised when the file mapping is incorrect. However, the customer was successfully importing files for a year before this issue was detected. and it happens because a row with 0 value on field balance of the XLSX file.
When parsing the file, if the balance field contains a value of 0, the condition if balance: evaluates to False. Consequently, the code enters the else block, setting the balance to None. However, a balance of 0 is valid, and this causes the object to be malformed, leading to the generic error.
This issue was encountered when the customer set a bank account's balance to 0 as part of a valid movement.
To Reproduce
Affected versions:
15.0
16.0
Steps to reproduce the behavior:
1.- Create a bank statement with a row where the balance is 0. For example:
2.- Import the file.
3.- Observe that the generic error is raised.
Expected behavior
The balance field with a value of 0 should be correctly parsed as a valid value.
Additional context
Solution?
Line 193 already accounts for cases where the balance field is not defined on xlsx file, setting it to None:
balance = (
values[columns["balance_column"]]
if columns["balance_column"] is not None
else None
)
Since 0 is a valid value, the condition should check if the balance is explicitly None, as shown below:
if balance is not None:
balance = self._parse_decimal(balance, mapping)
else:
balance = None
hope it helps
The text was updated successfully, but these errors were encountered:
Error while importing an XLXS file whith field balance 0 on any row
The error given is "This bank statement file format is not supported. Did you install the Odoo module to support this format?"
This is a generic error typically raised when the file mapping is incorrect. However, the customer was successfully importing files for a year before this issue was detected. and it happens because a row with 0 value on field balance of the XLSX file.
Module 15.0
bank-statement-import/account_statement_import_txt_xlsx
file: account_statement_import_sheet_parser.py
method: _parse_rows
Code Snippet (line 256):
if balance:
balance = self._parse_decimal(balance, mapping)
else:
balance = None
Describe the bug
When parsing the file, if the balance field contains a value of 0, the condition if balance: evaluates to False. Consequently, the code enters the else block, setting the balance to None. However, a balance of 0 is valid, and this causes the object to be malformed, leading to the generic error.
This issue was encountered when the customer set a bank account's balance to 0 as part of a valid movement.
To Reproduce
Affected versions:
15.0
16.0
Steps to reproduce the behavior:
1.- Create a bank statement with a row where the balance is 0. For example:
2.- Import the file.
3.- Observe that the generic error is raised.
Expected behavior
The balance field with a value of 0 should be correctly parsed as a valid value.
Additional context
Solution?
Line 193 already accounts for cases where the balance field is not defined on xlsx file, setting it to None:
balance = (
values[columns["balance_column"]]
if columns["balance_column"] is not None
else None
)
Since 0 is a valid value, the condition should check if the balance is explicitly None, as shown below:
if balance is not None:
balance = self._parse_decimal(balance, mapping)
else:
balance = None
hope it helps
The text was updated successfully, but these errors were encountered: