Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions account_statement_import_sheet_file/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ msgstr "Recuento de líneas omitidas a pie de página"

#. module: account_statement_import_sheet_file
#: model:ir.model.fields,field_description:account_statement_import_sheet_file.field_account_statement_import_sheet_mapping__header_lines_skip_count
msgid "Header lines skip count"
msgstr "Recuento de líneas de cabecera omitidas"
msgid "Header row number"
msgstr "Número de fila del encabezado"

#. module: account_statement_import_sheet_file
#: model:ir.model.fields,field_description:account_statement_import_sheet_file.field_account_statement_import_sheet_mapping__id
Expand Down Expand Up @@ -403,8 +403,8 @@ msgstr ""

#. module: account_statement_import_sheet_file
#: model:ir.model.fields,help:account_statement_import_sheet_file.field_account_statement_import_sheet_mapping__header_lines_skip_count
msgid "Set the Header lines number."
msgstr "Establezca el número de líneas de Cabecera."
msgid "Row number where the column headers are located (first row is 0)."
msgstr "Número de fila donde se encuentran los encabezados de columna (la primera fila es 0)."

#. module: account_statement_import_sheet_file
#: model:ir.model.fields,field_description:account_statement_import_sheet_file.field_account_statement_import__sheet_mapping_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ class AccountStatementImportSheetMapping(models.Model):
"transaction from"
),
)
amount_column = fields.Char(
Comment thread
pedrobaeza marked this conversation as resolved.
help="Amount of transaction in journal's currency",
)
amount_debit_column = fields.Char(
string="Debit amount column",
help="Debit amount of transaction in journal's currency",
Expand Down Expand Up @@ -122,7 +119,7 @@ class AccountStatementImportSheetMapping(models.Model):
required=True,
default="simple_value",
help=(
"Simple value: use igned amount in amount column\n"
"Simple value: use signed amount in amount column\n"
"Absolute Value: use a same column for debit and credit\n"
"(absolute value + indicate sign)\n"
"Distinct Credit/debit Column: use a distinct column for debit and credit"
Expand Down Expand Up @@ -173,8 +170,8 @@ class AccountStatementImportSheetMapping(models.Model):
default="0",
)
header_lines_skip_count = fields.Integer(
string="Header lines skip count",
help="Set the Header lines number.",
string="Header row number",
help="Row number where the column headers are located (first row is 0).",
default="0",
)
skip_empty_lines = fields.Boolean(
Expand Down Expand Up @@ -232,6 +229,13 @@ def onchange_decimal_separator(self):
elif "comma" == self.float_thousands_sep == self.float_decimal_sep:
self.float_thousands_sep = "dot"

@api.onchange("amount_type")
def _clear_amount_columns(self):
self.amount_column = False
self.debit_credit_column = False
self.amount_debit_column = False
self.amount_credit_column = False

@api.constrains("offset_column")
def _check_columns(self):
for mapping in self:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,22 @@ def _get_column_indexes(self, header, column_name, mapping):
column_indexes.append(column_index)
else:
if column_name_or_index:
column_indexes.append(header.index(column_name_or_index))
try:
column_indexes.append(header.index(column_name_or_index))
except ValueError:
# Fallback: case-insensitive match
column_index = next(
(
i
for i, h in enumerate(header)
if str(h).lower() == column_name_or_index.lower()
),
None,
)
if column_index is not None:
column_indexes.append(column_index)
else:
raise
return column_indexes

def _get_column_names(self):
Expand Down Expand Up @@ -403,6 +418,8 @@ def _parse_decimal(self, value, mapping):
return float(value)
elif isinstance(value, float):
return value
if not isinstance(value, str):
value = str(value)
thousands, decimal = mapping._get_float_separators()
# Remove all characters except digits, thousands separator,
# decimal separator, and signs
Expand Down
Loading