mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[IMP] account_bank_statement_import_txt_xlsx: black, isort, prettier
This commit is contained in:
@@ -9,7 +9,9 @@ class AccountBankStatementImportSheetMapping(models.Model):
|
||||
_name = "account.bank.statement.import.sheet.mapping"
|
||||
_description = "Account Bank Statement Import Sheet Mapping"
|
||||
|
||||
name = fields.Char(required=True,)
|
||||
name = fields.Char(
|
||||
required=True,
|
||||
)
|
||||
float_thousands_sep = fields.Selection(
|
||||
string="Thousands Separator",
|
||||
selection=[("dot", "dot (.)"), ("comma", "comma (,)"), ("none", "none")],
|
||||
@@ -68,7 +70,8 @@ class AccountBankStatementImportSheetMapping(models.Model):
|
||||
help="Amount of transaction in journal's currency",
|
||||
)
|
||||
balance_column = fields.Char(
|
||||
string="Balance column", help="Balance after transaction in journal's currency",
|
||||
string="Balance column",
|
||||
help="Balance after transaction in journal's currency",
|
||||
)
|
||||
original_currency_column = fields.Char(
|
||||
string="Original currency column",
|
||||
@@ -103,14 +106,28 @@ class AccountBankStatementImportSheetMapping(models.Model):
|
||||
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",)
|
||||
bank_name_column = fields.Char(string="Bank Name column", help="Partner's bank",)
|
||||
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",
|
||||
)
|
||||
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",
|
||||
string="Bank Account column",
|
||||
help="Partner's bank account",
|
||||
)
|
||||
|
||||
@api.onchange("float_thousands_sep")
|
||||
|
||||
@@ -14,6 +14,7 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from csv import reader
|
||||
|
||||
import xlrd
|
||||
from xlrd.xldate import xldate_as_datetime
|
||||
except (ImportError, IOError) as err: # pragma: no cover
|
||||
@@ -323,7 +324,8 @@ class AccountBankStatementImportSheetParser(models.TransientModel):
|
||||
}
|
||||
if currency != original_currency:
|
||||
original_currency = self.env["res.currency"].search(
|
||||
[("name", "=", original_currency)], limit=1,
|
||||
[("name", "=", original_currency)],
|
||||
limit=1,
|
||||
)
|
||||
if original_currency:
|
||||
transaction.update(
|
||||
@@ -335,7 +337,8 @@ class AccountBankStatementImportSheetParser(models.TransientModel):
|
||||
|
||||
if transaction_id:
|
||||
transaction["unique_import_id"] = "{}-{}".format(
|
||||
transaction_id, int(timestamp.timestamp()),
|
||||
transaction_id,
|
||||
int(timestamp.timestamp()),
|
||||
)
|
||||
|
||||
transaction["name"] = description or _("N/A")
|
||||
|
||||
@@ -22,13 +22,20 @@ class AccountBankStatementImportSheetMappingWizard(models.TransientModel):
|
||||
)
|
||||
header = fields.Char()
|
||||
file_encoding = fields.Selection(
|
||||
string="Encoding", selection=lambda self: self._selection_file_encoding(),
|
||||
string="Encoding",
|
||||
selection=lambda self: self._selection_file_encoding(),
|
||||
)
|
||||
delimiter = fields.Selection(
|
||||
string="Delimiter", selection=lambda self: self._selection_delimiter(),
|
||||
string="Delimiter",
|
||||
selection=lambda self: self._selection_delimiter(),
|
||||
)
|
||||
quotechar = fields.Char(
|
||||
string="Text qualifier",
|
||||
size=1,
|
||||
)
|
||||
timestamp_column = fields.Char(
|
||||
string="Timestamp column",
|
||||
)
|
||||
quotechar = fields.Char(string="Text qualifier", size=1,)
|
||||
timestamp_column = fields.Char(string="Timestamp column",)
|
||||
currency_column = fields.Char(
|
||||
string="Currency column",
|
||||
help=(
|
||||
@@ -37,10 +44,12 @@ class AccountBankStatementImportSheetMappingWizard(models.TransientModel):
|
||||
),
|
||||
)
|
||||
amount_column = fields.Char(
|
||||
string="Amount column", help="Amount of transaction in journal's currency",
|
||||
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",
|
||||
string="Balance column",
|
||||
help="Balance after transaction in journal's currency",
|
||||
)
|
||||
original_currency_column = fields.Char(
|
||||
string="Original currency column",
|
||||
@@ -75,14 +84,28 @@ class AccountBankStatementImportSheetMappingWizard(models.TransientModel):
|
||||
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",)
|
||||
bank_name_column = fields.Char(string="Bank Name column", help="Partner's bank",)
|
||||
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",
|
||||
)
|
||||
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",
|
||||
string="Bank Account column",
|
||||
help="Partner's bank account",
|
||||
)
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
# generated from manifests external_dependencies
|
||||
ofxparse
|
||||
xlrd
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../account_bank_statement_import_txt_xlsx
|
||||
6
setup/account_bank_statement_import_txt_xlsx/setup.py
Normal file
6
setup/account_bank_statement_import_txt_xlsx/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user