diff --git a/account_move_base_import/__manifest__.py b/account_move_base_import/__manifest__.py index 2a992f43..59449150 100644 --- a/account_move_base_import/__manifest__.py +++ b/account_move_base_import/__manifest__.py @@ -9,7 +9,7 @@ "author": "Akretion,Camptocamp,Odoo Community Association (OCA)", "category": "Finance", "depends": ["account"], - "website": "http://www.camptocamp.com", + "website": "https://github.com/OCA/account-reconcile", "data": [ "security/ir.model.access.csv", "data/completion_rule_data.xml", diff --git a/account_move_base_import/models/account_journal.py b/account_move_base_import/models/account_journal.py index 0f30677b..089210b1 100644 --- a/account_move_base_import/models/account_journal.py +++ b/account_move_base_import/models/account_journal.py @@ -285,7 +285,10 @@ class AccountJournal(models.Model): res = self.env["account.move"] for result_row_list in parser.parse(file_stream): 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 return res @@ -357,7 +360,8 @@ class AccountJournal(models.Model): except Exception: error_type, error_value, trbk = sys.exc_info() st = "Error: {}\nDescription: {}\nTraceback:".format( - error_type.__name__, error_value, + error_type.__name__, + error_value, ) st += "".join(traceback.format_tb(trbk, 30)) raise ValidationError( diff --git a/account_move_base_import/models/account_move.py b/account_move_base_import/models/account_move.py index d019bbcb..9e55c059 100644 --- a/account_move_base_import/models/account_move.py +++ b/account_move_base_import/models/account_move.py @@ -14,7 +14,7 @@ _logger = logging.getLogger(__name__) class ErrorTooManyPartner(Exception): - """ New Exception definition that is raised when more than one partner is + """New Exception definition that is raised when more than one partner is matched by the completion rule. """ @@ -165,7 +165,7 @@ class AccountMoveCompletionRule(models.Model): 'account_id': value, ...} - """ + """ res = {} partner_obj = self.env["res.partner"] or_regex = ".*;? *%s *;?.*" % line.name @@ -197,7 +197,7 @@ class AccountMoveCompletionRule(models.Model): 'account_id': value, ...} - """ + """ res = {} # The regexp_replace() escapes the name to avoid false positive # example: 'John J. Doe (No 1)' is escaped to 'John J\. Doe \(No 1\)' @@ -371,7 +371,8 @@ class AccountMove(models.Model): msg_lines.append(repr(exc)) error_type, error_value, trbk = sys.exc_info() st = "Error: {}\nDescription: {}\nTraceback:".format( - error_type.__name__, error_value, + error_type.__name__, + error_value, ) st += "".join(traceback.format_tb(trbk, 30)) _logger.error(st) @@ -382,7 +383,8 @@ class AccountMove(models.Model): msg_lines.append(repr(exc)) error_type, error_value, trbk = sys.exc_info() st = "Error: {}\nDescription: {}\nTraceback:".format( - error_type.__name__, error_value, + error_type.__name__, + error_value, ) st += "".join(traceback.format_tb(trbk, 30)) _logger.error(st) diff --git a/account_move_base_import/parser/file_parser.py b/account_move_base_import/parser/file_parser.py index 00c85770..12122ea4 100644 --- a/account_move_base_import/parser/file_parser.py +++ b/account_move_base_import/parser/file_parser.py @@ -22,7 +22,7 @@ except (ImportError, IOError) as err: def float_or_zero(val): - """ Conversion function used to manage + """Conversion function used to manage empty string into float usecase""" return float(val) if val else 0.0 @@ -43,14 +43,14 @@ class FileParser(AccountMoveImportParser): **kwargs ): """ - :param char: parse_name: The name of the parser - :param char: ftype: extension of the file (could be csv, xls or - xlsx) - :param dict: extra_fields: extra fields to put into the conversion - dict. In the format {fieldname: fieldtype} - :param list: header : specify header fields if the csv file has no - header - """ + :param char: parse_name: The name of the parser + :param char: ftype: extension of the file (could be csv, xls or + xlsx) + :param dict: extra_fields: extra fields to put into the conversion + dict. In the format {fieldname: fieldtype} + :param list: header : specify header fields if the csv file has no + header + """ super().__init__(journal, **kwargs) if ftype in ("csv", "xls", "xlsx"): self.ftype = ftype[0:3] diff --git a/account_move_base_import/tests/test_base_import.py b/account_move_base_import/tests/test_base_import.py index 5092b36d..5d52f904 100644 --- a/account_move_base_import/tests/test_base_import.py +++ b/account_move_base_import/tests/test_base_import.py @@ -43,7 +43,7 @@ class TestCodaImport(common.TransactionCase): ) def _import_file(self, file_name): - """ import a file using the wizard + """import a file using the wizard return the create account.bank.statement object """ with open(file_name, "rb") as f: @@ -59,8 +59,7 @@ class TestCodaImport(common.TransactionCase): return self.account_move_obj.browse(res["res_id"]) def test_simple_xls(self): - """Test import from xls - """ + """Test import from xls""" file_name = get_resource_path( "account_move_base_import", "tests", "data", "statement.xls" ) @@ -68,8 +67,7 @@ class TestCodaImport(common.TransactionCase): self._validate_imported_move(move) def test_simple_csv(self): - """Test import from csv - """ + """Test import from csv""" file_name = get_resource_path( "account_move_base_import", "tests", "data", "statement.csv" ) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..542d351c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# generated from manifests external_dependencies +xlrd diff --git a/setup/account_move_base_import/odoo/addons/account_move_base_import b/setup/account_move_base_import/odoo/addons/account_move_base_import new file mode 120000 index 00000000..9e14849e --- /dev/null +++ b/setup/account_move_base_import/odoo/addons/account_move_base_import @@ -0,0 +1 @@ +../../../../account_move_base_import \ No newline at end of file diff --git a/setup/account_move_base_import/setup.py b/setup/account_move_base_import/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_move_base_import/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)