Skip to content

Commit

Permalink
[IMP] account_statement_import_txt_xlsx : Add some improments
Browse files Browse the repository at this point in the history
  • Loading branch information
rov-adhoc committed May 23, 2024
1 parent 5a9ebae commit f281e86
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
9 changes: 5 additions & 4 deletions account_statement_import_txt_xlsx/i18n/es_AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ msgstr ""
#: model:ir.model.fields,field_description:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping__amount_credit_column
#: model:ir.model.fields,field_description:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping_wizard__amount_credit_column
msgid "Credit amount column"
msgstr ""
msgstr "Columna de débito"

#. module: account_statement_import_txt_xlsx
#: model:ir.model.fields,help:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping__amount_credit_column
#: model:ir.model.fields,help:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping_wizard__amount_credit_column
msgid "Credit amount of transaction in journal's currency"
msgstr ""
msgstr "Importe de débito de la transacción en la moneda del diario"

#. module: account_statement_import_txt_xlsx
#: model:ir.model.fields,field_description:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping__currency_column
Expand Down Expand Up @@ -198,13 +198,14 @@ msgstr "Valor de débito"
#: model:ir.model.fields,field_description:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping__amount_debit_column
#: model:ir.model.fields,field_description:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping_wizard__amount_debit_column
msgid "Debit amount column"
msgstr "Columna de débito"
msgstr "Columna de crédito"

#. module: account_statement_import_txt_xlsx
#: model:ir.model.fields,help:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping__amount_debit_column
#: model:ir.model.fields,help:account_statement_import_txt_xlsx.field_account_statement_import_sheet_mapping_wizard__amount_debit_column
msgid "Debit amount of transaction in journal's currency"
msgstr "Importe de débito de la transacción en la moneda del diario"
msgstr "Importe de crédito de la transacción en la moneda del diario"

#. module: account_statement_import_txt_xlsx
#: model_terms:ir.ui.view,arch_db:account_statement_import_txt_xlsx.account_statement_import_sheet_mapping_wizard_form
msgid "Debit/Credit column"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,20 @@ def _check_amount_type(self):
"have set Amount type = 'Distinct Credit/debit Column'"
)
)

@api.onchange('amount_type')
def _onchange_amount_type(self):
if self.amount_type == 'simple_value':
self.debit_credit_column = False
self.amount_debit_column = False
self.amount_credit_column = False
elif self.amount_type == 'absolute_value':
self.amount_column = False
self.amount_debit_column = False
self.amount_credit_column = False
elif self.amount_type == 'distinct_credit_debit':
self.amount_column = False
self.debit_credit_column = False

@api.onchange("float_thousands_sep")
def onchange_thousands_separator(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from decimal import Decimal
from io import StringIO
from os import path
import re

from odoo import _, api, models
from odoo.exceptions import UserError
Expand Down Expand Up @@ -479,8 +480,19 @@ def _convert_line_to_transactions(self, line): # noqa: C901

return [transaction]

def _extract_number(self,value):
value = str(value)
patron = r'[-+]?\d+'
correct_value = re.search(patron, value)
if correct_value:
return correct_value.group()
else:
return None


@api.model
def _parse_decimal(self, value, mapping):
value = self._extract_number(value)
if isinstance(value, Decimal):
return value
elif isinstance(value, float):
Expand Down

0 comments on commit f281e86

Please sign in to comment.