From 0550df383c2b59e3aa17622fc07d931727b488fa Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 5 Jun 2015 12:31:08 +0200 Subject: [PATCH] [IMP] Extract description to README Add OCA as author, PEP8 --- account_bank_statement_import/README.rst | 55 ++++++++++++++++ account_bank_statement_import/__openerp__.py | 9 +-- .../account_bank_statement_import.py | 4 +- account_bank_statement_import_ofx/README.rst | 63 +++++++++++++++++++ .../__openerp__.py | 35 +++-------- .../account_bank_statement_import_ofx.py | 4 +- .../tests/test_import_bank_statement.py | 9 --- account_bank_statement_import_qif/README.rst | 58 +++++++++++++++++ .../__openerp__.py | 27 +++----- .../account_bank_statement_import_qif.py | 22 ++++--- 10 files changed, 215 insertions(+), 71 deletions(-) create mode 100644 account_bank_statement_import/README.rst create mode 100644 account_bank_statement_import_ofx/README.rst create mode 100644 account_bank_statement_import_qif/README.rst diff --git a/account_bank_statement_import/README.rst b/account_bank_statement_import/README.rst new file mode 100644 index 0000000..e83688f --- /dev/null +++ b/account_bank_statement_import/README.rst @@ -0,0 +1,55 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Account Bank Statement Import +============================= + +This module add a generic wizard to import Bank Statements. It also extend +the bank account module to sanitize the account number and extend the search +method to use this field when searching on account_number. + +The module has been initiated by a backport of the new framework developed +by Odoo for V9 at its early stage. It's no more kept in sync with the V9 since +it has reach a stage where maintaining a pure backport of 9.0 in 8.0 is not +feasible anymore + +Known issues / Roadmap +====================== + +* None + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Odoo SA +* Pedro M. Baeza +* Alexis de Lattre +* Laurent Mignon +* Ronald Portier + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/account_bank_statement_import/__openerp__.py b/account_bank_statement_import/__openerp__.py index 2c79122..1d42ae2 100644 --- a/account_bank_statement_import/__openerp__.py +++ b/account_bank_statement_import/__openerp__.py @@ -3,13 +3,10 @@ 'name': 'Account Bank Statement Import', 'category': 'Accounting & Finance', 'version': '1.0', - 'author': 'OpenERP SA', + 'author': 'OpenERP SA,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/bank-statement-import', 'depends': ['account'], - 'demo': [], - 'description': """Generic Wizard to Import Bank Statements. - - Backport from Odoo 9.0 - """, 'data': [ 'account_bank_statement_import_view.xml', ], diff --git a/account_bank_statement_import/account_bank_statement_import.py b/account_bank_statement_import/account_bank_statement_import.py index 98950c6..cd7a46c 100644 --- a/account_bank_statement_import/account_bank_statement_import.py +++ b/account_bank_statement_import/account_bank_statement_import.py @@ -9,7 +9,7 @@ import logging _logger = logging.getLogger(__name__) -class account_bank_statement_line(models.Model): +class AccountBankStatementLine(models.Model): _inherit = "account.bank.statement.line" # Ensure transactions can be imported only once (if the import format @@ -23,7 +23,7 @@ class account_bank_statement_line(models.Model): ] -class account_bank_statement_import(models.TransientModel): +class AccountBankStatementImport(models.TransientModel): _name = 'account.bank.statement.import' _description = 'Import Bank Statement' diff --git a/account_bank_statement_import_ofx/README.rst b/account_bank_statement_import_ofx/README.rst new file mode 100644 index 0000000..6fb1260 --- /dev/null +++ b/account_bank_statement_import_ofx/README.rst @@ -0,0 +1,63 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Import OFX Bank Statement +========================= + +This module allows you to import the machine readable OFX Files in Odoo: they are parsed and stored in human readable format in +Accounting \ Bank and Cash \ Bank Statements. + +Bank Statements may be generated containing a subset of the OFX information (only those transaction lines that are required for the +creation of the Financial Accounting records). + +The module has been initiated by a backport of the new framework developed +by Odoo for V9 at its early stage. It's no more kept in sync with the V9 since +it has reach a stage where maintaining a pure backport of 9.0 in 8.0 is not +feasible anymore + +Installation +============ + +The module requires one additional python lib: + +* `ofxparse `_ + +Known issues / Roadmap +====================== + +* None + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Odoo SA +* Alexis de Lattre +* Laurent Mignon +* Ronald Portier + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/account_bank_statement_import_ofx/__openerp__.py b/account_bank_statement_import_ofx/__openerp__.py index 8832984..212ac31 100644 --- a/account_bank_statement_import_ofx/__openerp__.py +++ b/account_bank_statement_import_ofx/__openerp__.py @@ -1,32 +1,17 @@ # -*- encoding: utf-8 -*- -# noqa: This is a backport from Odoo. OCA has no control over style here. -# flake8: noqa { 'name': 'Import OFX Bank Statement', - 'category' : 'Accounting & Finance', + 'category': 'Accounting & Finance', 'version': '1.0', - 'author': 'OpenERP SA', - 'depends': ['account_bank_statement_import'], - 'demo': [], - 'description' : """ -Module to import OFX bank statements. -====================================== - -This module allows you to import the machine readable OFX Files in Odoo: they are parsed and stored in human readable format in -Accounting \ Bank and Cash \ Bank Statements. - -Bank Statements may be generated containing a subset of the OFX information (only those transaction lines that are required for the -creation of the Financial Accounting records). - -Backported from Odoo 9.0 - -When testing with the provided test file, make sure the demo data from the -base account_bank_statement_import module has been imported, or manually -create periods for the year 2013. - """, - 'data' : [], - 'depends': ['account_bank_statement_import'], - 'demo': [], + 'author': 'OpenERP SA,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/bank-statement-import', + 'depends': [ + 'account_bank_statement_import' + ], + 'external_dependencies': { + 'python': ['ofxparse'], + }, 'auto_install': True, 'installable': True, } diff --git a/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py index 93c8931..9358ae1 100644 --- a/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py +++ b/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py @@ -16,7 +16,7 @@ except ImportError: ofxparser = None -class account_bank_statement_import(models.TransientModel): +class AccountBankStatementImport(models.TransientModel): _inherit = 'account.bank.statement.import' @api.model @@ -33,7 +33,7 @@ class account_bank_statement_import(models.TransientModel): def _parse_file(self, data_file): ofx = self._check_ofx(data_file) if not ofx: - return super(account_bank_statement_import, self)._parse_file( + return super(AccountBankStatementImport, self)._parse_file( data_file) transactions = [] diff --git a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py index ad54f3d..b35afa1 100644 --- a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# noqa: This is a backport from Odoo. OCA has no control over style here. -# flake8: noqa from openerp.tests.common import TransactionCase from openerp.modules.module import get_module_resource @@ -16,12 +14,6 @@ class TestOfxFile(TransactionCase): self.bank_statement_model = self.env['account.bank.statement'] def test_ofx_file_import(self): - try: - from ofxparse import OfxParser as ofxparser - except ImportError: - # the Python library isn't installed on the server, the OFX import - # is unavailable and the test cannot be run - return True ofx_file_path = get_module_resource( 'account_bank_statement_import_ofx', 'test_ofx_file', 'test_ofx.ofx') @@ -41,4 +33,3 @@ class TestOfxFile(TransactionCase): self.assertEquals( line.bank_account_id.id, self.ref('account_bank_statement_import.ofx_partner_bank_1')) - diff --git a/account_bank_statement_import_qif/README.rst b/account_bank_statement_import_qif/README.rst new file mode 100644 index 0000000..66411e6 --- /dev/null +++ b/account_bank_statement_import_qif/README.rst @@ -0,0 +1,58 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +Module to import QIF bank statements. +===================================== + +This module allows you to import the machine readable QIF Files in Odoo: they are parsed and stored in human readable format in +Accounting \ Bank and Cash \ Bank Statements. + +Important Note +--------------- +Because of the QIF format limitation, we cannot ensure the same transactions aren't imported several times or handle multicurrency. +Whenever possible, you should use a more appropriate file format like OFX. + +The module has been initiated by a backport of the new framework developed +by Odoo for V9 at its early stage. It's no more kept in sync with the V9 since +it has reach a stage where maintaining a pure backport of 9.0 in 8.0 is not +feasible anymore + +Known issues / Roadmap +====================== + +* None + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback +`here `_. + + +Credits +======= + +Contributors +------------ + +* Odoo SA +* Alexis de Lattre +* Laurent Mignon +* Ronald Portier + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/account_bank_statement_import_qif/__openerp__.py b/account_bank_statement_import_qif/__openerp__.py index 11fd371..59eaef8 100644 --- a/account_bank_statement_import_qif/__openerp__.py +++ b/account_bank_statement_import_qif/__openerp__.py @@ -1,28 +1,19 @@ # -*- coding: utf-8 -*- -# noqa: This is a backport from Odoo. OCA has no control over style here. -# flake8: noqa { 'name': 'Import QIF Bank Statement', 'category': 'Accounting & Finance', 'version': '1.0', - 'author': 'OpenERP SA', - 'description': ''' -Module to import QIF bank statements. -====================================== - -This module allows you to import the machine readable QIF Files in Odoo: they are parsed and stored in human readable format in -Accounting \ Bank and Cash \ Bank Statements. - -Important Note ---------------------------------------------- -Because of the QIF format limitation, we cannot ensure the same transactions aren't imported several times or handle multicurrency. -Whenever possible, you should use a more appropriate file format like OFX. -''', + 'author': 'OpenERP SA,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/bank-statement-import', 'images': [], - 'depends': ['account_bank_statement_import'], - 'demo': [], - 'data': ['account_bank_statement_import_qif_view.xml'], + 'depends': [ + 'account_bank_statement_import' + ], + 'data': [ + 'account_bank_statement_import_qif_view.xml' + ], 'auto_install': False, 'installable': True, } diff --git a/account_bank_statement_import_qif/account_bank_statement_import_qif.py b/account_bank_statement_import_qif/account_bank_statement_import_qif.py index a3aa25f..cac2bc5 100644 --- a/account_bank_statement_import_qif/account_bank_statement_import_qif.py +++ b/account_bank_statement_import_qif/account_bank_statement_import_qif.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# noqa: This is a backport from Odoo. OCA has no control over style here. -# flake8: noqa import dateutil.parser import StringIO @@ -10,7 +8,7 @@ from openerp import api, models, fields from openerp.exceptions import Warning -class account_bank_statement_import(models.TransientModel): +class AccountBankStatementImport(models.TransientModel): _inherit = "account.bank.statement.import" @api.model @@ -37,7 +35,7 @@ class account_bank_statement_import(models.TransientModel): record = self.browse(active_id) if record.journal_id: record = record.with_context(journal_id=record.journal_id.id) - return super(account_bank_statement_import, record)._get_journal( + return super(AccountBankStatementImport, record)._get_journal( currency_id, bank_account_id, account_number) @api.model @@ -47,7 +45,7 @@ class account_bank_statement_import(models.TransientModel): @api.model def _parse_file(self, data_file): if not self._check_qif(data_file): - return super(account_bank_statement_import, self)._parse_file( + return super(AccountBankStatementImport, self)._parse_file( data_file) try: @@ -80,9 +78,13 @@ class account_bank_statement_import(models.TransientModel): elif line[0] == 'N': # Check number vals_line['ref'] = line[1:] elif line[0] == 'P': # Payee - vals_line['name'] = 'name' in vals_line and line[1:] + ': ' + vals_line['name'] or line[1:] - # Since QIF doesn't provide account numbers, we'll have to find res.partner and res.partner.bank here - # (normal behavious is to provide 'account_number', which the generic module uses to find partner/bank) + vals_line['name'] = ('name' in vals_line and + line[1:] + ': ' + vals_line['name'] or + line[1:]) + # Since QIF doesn't provide account numbers, we'll have to + # find res.partner and res.partner.bank here + # (normal behavious is to provide 'account_number', which + # the generic module uses to find partner/bank) banks = self.env['res.partner.bank'].search( [('owner_name', '=', line[1:])], limit=1) if banks: @@ -90,7 +92,9 @@ class account_bank_statement_import(models.TransientModel): vals_line['bank_account_id'] = bank_account.id vals_line['partner_id'] = bank_account.partner_id.id elif line[0] == 'M': # Memo - vals_line['name'] = 'name' in vals_line and vals_line['name'] + ': ' + line[1:] or line[1:] + vals_line['name'] = ('name' in vals_line and + vals_line['name'] + ': ' + line[1:] or + line[1:]) elif line[0] == '^': # end of item transactions.append(vals_line) vals_line = {}