[MIG] account_statement_import_txt_xlsx: Migration to 15.0

This commit is contained in:
nicolas
2022-10-05 16:01:01 -03:00
committed by Katherine Zaoral
parent 0e236e90b5
commit 3e9fc9cc12
5 changed files with 15 additions and 51 deletions

View File

@@ -5,7 +5,7 @@
{
"name": "Bank Statement TXT/CSV/XLSX Import",
"summary": "Import TXT/CSV or XLSX files as Bank Statements in Odoo",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/bank-statement-import",
"author": "ForgeFlow, CorporateHub, Odoo Community Association (OCA)",

View File

@@ -43,7 +43,6 @@ class AccountStatementImportSheetMapping(models.Model):
default="utf-8",
)
delimiter = fields.Selection(
string="Delimiter",
selection=[
("dot", "dot (.)"),
("comma", "comma (,)"),
@@ -55,26 +54,22 @@ class AccountStatementImportSheetMapping(models.Model):
default="comma",
)
quotechar = fields.Char(string="Text qualifier", size=1, default='"')
timestamp_format = fields.Char(string="Timestamp Format", required=True)
timestamp_column = fields.Char(string="Timestamp column", required=True)
timestamp_format = fields.Char(required=True)
timestamp_column = fields.Char(required=True)
currency_column = fields.Char(
string="Currency column",
help=(
"In case statement is multi-currency, column to get currency of "
"transaction from"
),
)
amount_column = fields.Char(
string="Amount column",
required=True,
help="Amount of transaction in journal's currency",
)
balance_column = fields.Char(
string="Balance column",
help="Balance after transaction in journal's currency",
)
original_currency_column = fields.Char(
string="Original currency column",
help=(
"In case statement provides original currency for transactions "
"with automatic currency conversion, column to get original "
@@ -82,7 +77,6 @@ class AccountStatementImportSheetMapping(models.Model):
),
)
original_amount_column = fields.Char(
string="Original amount column",
help=(
"In case statement provides original currency for transactions "
"with automatic currency conversion, column to get original "
@@ -97,36 +91,24 @@ class AccountStatementImportSheetMapping(models.Model):
),
)
debit_value = fields.Char(
string="Debit value",
help="Value of debit/credit column that indicates if it's a debit",
default="D",
)
credit_value = fields.Char(
string="Credit value",
help="Value of debit/credit column that indicates if it's a credit",
default="C",
)
transaction_id_column = fields.Char(
string="Unique transaction ID column",
)
description_column = fields.Char(
string="Description column",
)
notes_column = fields.Char(
string="Notes column",
)
reference_column = fields.Char(
string="Reference column",
)
partner_name_column = fields.Char(
string="Partner Name column",
)
description_column = fields.Char()
notes_column = fields.Char()
reference_column = fields.Char()
partner_name_column = fields.Char()
bank_name_column = fields.Char(
string="Bank Name column",
help="Partner's bank",
)
bank_account_column = fields.Char(
string="Bank Account column",
help="Partner's bank account",
)

View File

@@ -36,7 +36,7 @@ class AccountStatementImportSheetParser(models.TransientModel):
values = sheet.row_values(0)
return [str(value) for value in values]
except xlrd.XLRDError:
pass
_logger.error("Pass this method")
data = StringIO(data_file.decode(encoding or "utf-8"))
csv_data = reader(data, **csv_options)

View File

@@ -17,6 +17,8 @@ class TestAccountBankStatementImportTxtXlsx(common.TransactionCase):
self.now = fields.Datetime.now()
self.currency_eur = self.env.ref("base.EUR")
self.currency_usd = self.env.ref("base.USD")
# Activate EUR for unit test, by default is not active
self.currency_eur.active = True
self.sample_statement_map = self.env.ref(
"account_statement_import_txt_xlsx.sample_statement_map"
)

View File

@@ -26,33 +26,26 @@ class AccountStatementImportSheetMappingWizard(models.TransientModel):
selection=lambda self: self._selection_file_encoding(),
)
delimiter = fields.Selection(
string="Delimiter",
selection=lambda self: self._selection_delimiter(),
)
quotechar = fields.Char(
string="Text qualifier",
size=1,
)
timestamp_column = fields.Char(
string="Timestamp column",
)
timestamp_column = fields.Char()
currency_column = fields.Char(
string="Currency column",
help=(
"In case statement is multi-currency, column to get currency of "
"transaction from"
),
)
amount_column = fields.Char(
string="Amount column",
help="Amount of transaction in journal's currency",
)
balance_column = fields.Char(
string="Balance column",
help="Balance after transaction in journal's currency",
)
original_currency_column = fields.Char(
string="Original currency column",
help=(
"In case statement provides original currency for transactions "
"with automatic currency conversion, column to get original "
@@ -60,7 +53,6 @@ class AccountStatementImportSheetMappingWizard(models.TransientModel):
),
)
original_amount_column = fields.Char(
string="Original amount column",
help=(
"In case statement provides original currency for transactions "
"with automatic currency conversion, column to get original "
@@ -75,36 +67,24 @@ class AccountStatementImportSheetMappingWizard(models.TransientModel):
),
)
debit_value = fields.Char(
string="Debit value",
help="Value of debit/credit column that indicates if it's a debit",
default="D",
)
credit_value = fields.Char(
string="Credit value",
help="Value of debit/credit column that indicates if it's a credit",
default="C",
)
transaction_id_column = fields.Char(
string="Unique transaction ID column",
)
description_column = fields.Char(
string="Description column",
)
notes_column = fields.Char(
string="Notes column",
)
reference_column = fields.Char(
string="Reference column",
)
partner_name_column = fields.Char(
string="Partner Name column",
)
description_column = fields.Char()
notes_column = fields.Char()
reference_column = fields.Char()
partner_name_column = fields.Char()
bank_name_column = fields.Char(
string="Bank Name column",
help="Partner's bank",
)
bank_account_column = fields.Char(
string="Bank Account column",
help="Partner's bank account",
)