[IMP] account_move_base_import: black, isort, prettier

This commit is contained in:
Florian da Costa
2021-01-03 16:08:01 +01:00
parent beb011c725
commit 7c349daae5
5 changed files with 26 additions and 22 deletions

View File

@@ -9,7 +9,7 @@
"author": "Akretion,Camptocamp,Odoo Community Association (OCA)", "author": "Akretion,Camptocamp,Odoo Community Association (OCA)",
"category": "Finance", "category": "Finance",
"depends": ["account"], "depends": ["account"],
"website": "http://www.camptocamp.com", "website": "https://github.com/OCA/account-reconcile",
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
"data/completion_rule_data.xml", "data/completion_rule_data.xml",

View File

@@ -285,7 +285,10 @@ class AccountJournal(models.Model):
res = self.env["account.move"] res = self.env["account.move"]
for result_row_list in parser.parse(file_stream): for result_row_list in parser.parse(file_stream):
move = self._move_import( move = self._move_import(
parser, file_stream, result_row_list=result_row_list, ftype=ftype, parser,
file_stream,
result_row_list=result_row_list,
ftype=ftype,
) )
res |= move res |= move
return res return res
@@ -357,7 +360,8 @@ class AccountJournal(models.Model):
except Exception: except Exception:
error_type, error_value, trbk = sys.exc_info() error_type, error_value, trbk = sys.exc_info()
st = "Error: {}\nDescription: {}\nTraceback:".format( st = "Error: {}\nDescription: {}\nTraceback:".format(
error_type.__name__, error_value, error_type.__name__,
error_value,
) )
st += "".join(traceback.format_tb(trbk, 30)) st += "".join(traceback.format_tb(trbk, 30))
raise ValidationError( raise ValidationError(

View File

@@ -371,7 +371,8 @@ class AccountMove(models.Model):
msg_lines.append(repr(exc)) msg_lines.append(repr(exc))
error_type, error_value, trbk = sys.exc_info() error_type, error_value, trbk = sys.exc_info()
st = "Error: {}\nDescription: {}\nTraceback:".format( st = "Error: {}\nDescription: {}\nTraceback:".format(
error_type.__name__, error_value, error_type.__name__,
error_value,
) )
st += "".join(traceback.format_tb(trbk, 30)) st += "".join(traceback.format_tb(trbk, 30))
_logger.error(st) _logger.error(st)
@@ -382,7 +383,8 @@ class AccountMove(models.Model):
msg_lines.append(repr(exc)) msg_lines.append(repr(exc))
error_type, error_value, trbk = sys.exc_info() error_type, error_value, trbk = sys.exc_info()
st = "Error: {}\nDescription: {}\nTraceback:".format( st = "Error: {}\nDescription: {}\nTraceback:".format(
error_type.__name__, error_value, error_type.__name__,
error_value,
) )
st += "".join(traceback.format_tb(trbk, 30)) st += "".join(traceback.format_tb(trbk, 30))
_logger.error(st) _logger.error(st)

View File

@@ -59,8 +59,7 @@ class TestCodaImport(common.TransactionCase):
return self.account_move_obj.browse(res["res_id"]) return self.account_move_obj.browse(res["res_id"])
def test_simple_xls(self): def test_simple_xls(self):
"""Test import from xls """Test import from xls"""
"""
file_name = get_resource_path( file_name = get_resource_path(
"account_move_base_import", "tests", "data", "statement.xls" "account_move_base_import", "tests", "data", "statement.xls"
) )
@@ -68,8 +67,7 @@ class TestCodaImport(common.TransactionCase):
self._validate_imported_move(move) self._validate_imported_move(move)
def test_simple_csv(self): def test_simple_csv(self):
"""Test import from csv """Test import from csv"""
"""
file_name = get_resource_path( file_name = get_resource_path(
"account_move_base_import", "tests", "data", "statement.csv" "account_move_base_import", "tests", "data", "statement.csv"
) )