mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[IMP] Extract description to README
Add OCA as author, PEP8
This commit is contained in:
committed by
Laurent Mignon (ACSONE)
parent
1dcd07e893
commit
0550df383c
55
account_bank_statement_import/README.rst
Normal file
55
account_bank_statement_import/README.rst
Normal file
@@ -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 <https://github.com/OCA/bank-statement-import/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 <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Odoo SA
|
||||||
|
* Pedro M. Baeza <pedro.baeza@gmail.com>
|
||||||
|
* Alexis de Lattre <alexis@via.ecp.fr>
|
||||||
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
|
* Ronald Portier <rportier@therp.nl>
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -3,13 +3,10 @@
|
|||||||
'name': 'Account Bank Statement Import',
|
'name': 'Account Bank Statement Import',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'author': 'OpenERP SA',
|
'author': 'OpenERP SA,'
|
||||||
|
'Odoo Community Association (OCA)',
|
||||||
|
'website': 'https://github.com/OCA/bank-statement-import',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'demo': [],
|
|
||||||
'description': """Generic Wizard to Import Bank Statements.
|
|
||||||
|
|
||||||
Backport from Odoo 9.0
|
|
||||||
""",
|
|
||||||
'data': [
|
'data': [
|
||||||
'account_bank_statement_import_view.xml',
|
'account_bank_statement_import_view.xml',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import logging
|
|||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class account_bank_statement_line(models.Model):
|
class AccountBankStatementLine(models.Model):
|
||||||
_inherit = "account.bank.statement.line"
|
_inherit = "account.bank.statement.line"
|
||||||
|
|
||||||
# Ensure transactions can be imported only once (if the import format
|
# 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'
|
_name = 'account.bank.statement.import'
|
||||||
_description = 'Import Bank Statement'
|
_description = 'Import Bank Statement'
|
||||||
|
|
||||||
|
|||||||
63
account_bank_statement_import_ofx/README.rst
Normal file
63
account_bank_statement_import_ofx/README.rst
Normal file
@@ -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 <http://pypi.python.org/pypi/ofxparse>`_
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
* None
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
|
||||||
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/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 <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_ofx%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Odoo SA
|
||||||
|
* Alexis de Lattre <alexis@via.ecp.fr>
|
||||||
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
|
* Ronald Portier <rportier@therp.nl>
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -1,32 +1,17 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
# noqa: This is a backport from Odoo. OCA has no control over style here.
|
|
||||||
# flake8: noqa
|
|
||||||
{
|
{
|
||||||
'name': 'Import OFX Bank Statement',
|
'name': 'Import OFX Bank Statement',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'author': 'OpenERP SA',
|
'author': 'OpenERP SA,'
|
||||||
'depends': ['account_bank_statement_import'],
|
'Odoo Community Association (OCA)',
|
||||||
'demo': [],
|
'website': 'https://github.com/OCA/bank-statement-import',
|
||||||
'description' : """
|
'depends': [
|
||||||
Module to import OFX bank statements.
|
'account_bank_statement_import'
|
||||||
======================================
|
],
|
||||||
|
'external_dependencies': {
|
||||||
This module allows you to import the machine readable OFX Files in Odoo: they are parsed and stored in human readable format in
|
'python': ['ofxparse'],
|
||||||
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': [],
|
|
||||||
'auto_install': True,
|
'auto_install': True,
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ except ImportError:
|
|||||||
ofxparser = None
|
ofxparser = None
|
||||||
|
|
||||||
|
|
||||||
class account_bank_statement_import(models.TransientModel):
|
class AccountBankStatementImport(models.TransientModel):
|
||||||
_inherit = 'account.bank.statement.import'
|
_inherit = 'account.bank.statement.import'
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -33,7 +33,7 @@ class account_bank_statement_import(models.TransientModel):
|
|||||||
def _parse_file(self, data_file):
|
def _parse_file(self, data_file):
|
||||||
ofx = self._check_ofx(data_file)
|
ofx = self._check_ofx(data_file)
|
||||||
if not ofx:
|
if not ofx:
|
||||||
return super(account_bank_statement_import, self)._parse_file(
|
return super(AccountBankStatementImport, self)._parse_file(
|
||||||
data_file)
|
data_file)
|
||||||
|
|
||||||
transactions = []
|
transactions = []
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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.tests.common import TransactionCase
|
||||||
from openerp.modules.module import get_module_resource
|
from openerp.modules.module import get_module_resource
|
||||||
|
|
||||||
@@ -16,12 +14,6 @@ class TestOfxFile(TransactionCase):
|
|||||||
self.bank_statement_model = self.env['account.bank.statement']
|
self.bank_statement_model = self.env['account.bank.statement']
|
||||||
|
|
||||||
def test_ofx_file_import(self):
|
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(
|
ofx_file_path = get_module_resource(
|
||||||
'account_bank_statement_import_ofx',
|
'account_bank_statement_import_ofx',
|
||||||
'test_ofx_file', 'test_ofx.ofx')
|
'test_ofx_file', 'test_ofx.ofx')
|
||||||
@@ -41,4 +33,3 @@ class TestOfxFile(TransactionCase):
|
|||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
line.bank_account_id.id,
|
line.bank_account_id.id,
|
||||||
self.ref('account_bank_statement_import.ofx_partner_bank_1'))
|
self.ref('account_bank_statement_import.ofx_partner_bank_1'))
|
||||||
|
|
||||||
|
|||||||
58
account_bank_statement_import_qif/README.rst
Normal file
58
account_bank_statement_import_qif/README.rst
Normal file
@@ -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 <https://github.com/OCA/bank-statement-import/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 <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_ofx%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Odoo SA
|
||||||
|
* Alexis de Lattre <alexis@via.ecp.fr>
|
||||||
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
|
* Ronald Portier <rportier@therp.nl>
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -1,28 +1,19 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# noqa: This is a backport from Odoo. OCA has no control over style here.
|
|
||||||
# flake8: noqa
|
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Import QIF Bank Statement',
|
'name': 'Import QIF Bank Statement',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
'version': '1.0',
|
'version': '1.0',
|
||||||
'author': 'OpenERP SA',
|
'author': 'OpenERP SA,'
|
||||||
'description': '''
|
'Odoo Community Association (OCA)',
|
||||||
Module to import QIF bank statements.
|
'website': 'https://github.com/OCA/bank-statement-import',
|
||||||
======================================
|
|
||||||
|
|
||||||
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.
|
|
||||||
''',
|
|
||||||
'images': [],
|
'images': [],
|
||||||
'depends': ['account_bank_statement_import'],
|
'depends': [
|
||||||
'demo': [],
|
'account_bank_statement_import'
|
||||||
'data': ['account_bank_statement_import_qif_view.xml'],
|
],
|
||||||
|
'data': [
|
||||||
|
'account_bank_statement_import_qif_view.xml'
|
||||||
|
],
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# noqa: This is a backport from Odoo. OCA has no control over style here.
|
|
||||||
# flake8: noqa
|
|
||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import StringIO
|
import StringIO
|
||||||
@@ -10,7 +8,7 @@ from openerp import api, models, fields
|
|||||||
from openerp.exceptions import Warning
|
from openerp.exceptions import Warning
|
||||||
|
|
||||||
|
|
||||||
class account_bank_statement_import(models.TransientModel):
|
class AccountBankStatementImport(models.TransientModel):
|
||||||
_inherit = "account.bank.statement.import"
|
_inherit = "account.bank.statement.import"
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -37,7 +35,7 @@ class account_bank_statement_import(models.TransientModel):
|
|||||||
record = self.browse(active_id)
|
record = self.browse(active_id)
|
||||||
if record.journal_id:
|
if record.journal_id:
|
||||||
record = record.with_context(journal_id=record.journal_id.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)
|
currency_id, bank_account_id, account_number)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -47,7 +45,7 @@ class account_bank_statement_import(models.TransientModel):
|
|||||||
@api.model
|
@api.model
|
||||||
def _parse_file(self, data_file):
|
def _parse_file(self, data_file):
|
||||||
if not self._check_qif(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)
|
data_file)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -80,9 +78,13 @@ class account_bank_statement_import(models.TransientModel):
|
|||||||
elif line[0] == 'N': # Check number
|
elif line[0] == 'N': # Check number
|
||||||
vals_line['ref'] = line[1:]
|
vals_line['ref'] = line[1:]
|
||||||
elif line[0] == 'P': # Payee
|
elif line[0] == 'P': # Payee
|
||||||
vals_line['name'] = 'name' in vals_line and line[1:] + ': ' + vals_line['name'] or line[1:]
|
vals_line['name'] = ('name' in vals_line and
|
||||||
# Since QIF doesn't provide account numbers, we'll have to find res.partner and res.partner.bank here
|
line[1:] + ': ' + vals_line['name'] or
|
||||||
# (normal behavious is to provide 'account_number', which the generic module uses to find partner/bank)
|
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(
|
banks = self.env['res.partner.bank'].search(
|
||||||
[('owner_name', '=', line[1:])], limit=1)
|
[('owner_name', '=', line[1:])], limit=1)
|
||||||
if banks:
|
if banks:
|
||||||
@@ -90,7 +92,9 @@ class account_bank_statement_import(models.TransientModel):
|
|||||||
vals_line['bank_account_id'] = bank_account.id
|
vals_line['bank_account_id'] = bank_account.id
|
||||||
vals_line['partner_id'] = bank_account.partner_id.id
|
vals_line['partner_id'] = bank_account.partner_id.id
|
||||||
elif line[0] == 'M': # Memo
|
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
|
elif line[0] == '^': # end of item
|
||||||
transactions.append(vals_line)
|
transactions.append(vals_line)
|
||||||
vals_line = {}
|
vals_line = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user