Browse Source
[IMP] account_bank_statement_qif: use new API + i18n + move journal_id to main
pull/129/head
[IMP] account_bank_statement_qif: use new API + i18n + move journal_id to main
pull/129/head
Laurent Mignon (ACSONE)
10 years ago
committed by
Pedro M. Baeza
8 changed files with 177 additions and 105 deletions
-
58account_bank_statement_import_qif/README.rst
-
1account_bank_statement_import_qif/__init__.py
-
26account_bank_statement_import_qif/__openerp__.py
-
87account_bank_statement_import_qif/account_bank_statement_import_qif.py
-
24account_bank_statement_import_qif/account_bank_statement_import_qif_view.xml
-
49account_bank_statement_import_qif/i18n/account_bank_statement_import_qif.pot
-
2account_bank_statement_import_qif/tests/__init__.py
-
35account_bank_statement_import_qif/tests/test_import_bank_statement.py
@ -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,3 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import account_bank_statement_import_qif |
|||
|
@ -1,28 +1,16 @@ |
|||
# -*- 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', |
|||
'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' |
|||
], |
|||
'auto_install': False, |
|||
'installable': True, |
|||
} |
@ -1,24 +0,0 @@ |
|||
<?xml version="1.0" ?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="account_bank_statement_import_view_inherited" model="ir.ui.view"> |
|||
<field name="name">Import Bank Statements Inherited</field> |
|||
<field name="model">account.bank.statement.import</field> |
|||
<field name="priority" eval="20"/> |
|||
<field name="inherit_id" ref="account_bank_statement_import.account_bank_statement_import_view" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='data_file']" position="after"> |
|||
<field name="hide_journal_field" invisible="1"/> |
|||
<label for="journal_id"/> |
|||
<field name="journal_id" |
|||
domain="[('type', '=', 'bank')]" |
|||
attrs="{'invisible': [('hide_journal_field', '=', True)]}" |
|||
context="{'default_type':'bank'}"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
|||
|
@ -0,0 +1,49 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * account_bank_statement_import_qif |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 8.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2015-06-08 12:01+0000\n" |
|||
"PO-Revision-Date: 2015-06-08 12:01+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: help:account.bank.statement.import,journal_id:0 |
|||
msgid "Accounting journal related to the bank statement you're importing. It has be be manually chosen for statement formats which doesn't allow automatic journal detection (QIF for example)." |
|||
msgstr "" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:54 |
|||
#, python-format |
|||
msgid "Could not decipher the QIF file." |
|||
msgstr "" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: field:account.bank.statement.import,hide_journal_field:0 |
|||
msgid "Hide the journal field in the view" |
|||
msgstr "" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: model:ir.model,name:account_bank_statement_import_qif.model_account_bank_statement_import |
|||
msgid "Import Bank Statement" |
|||
msgstr "" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: field:account.bank.statement.import,journal_id:0 |
|||
msgid "Journal" |
|||
msgstr "" |
|||
|
|||
#. module: account_bank_statement_import_qif |
|||
#: code:addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py:98 |
|||
#, python-format |
|||
msgid "This file is either not a bank statement or is not correctly formed." |
|||
msgstr "" |
|||
|
@ -1,4 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# noqa: This is a backport from Odoo. OCA has no control over style here. |
|||
# flake8: noqa |
|||
from . import test_import_bank_statement |
@ -1,32 +1,29 @@ |
|||
# -*- 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 |
|||
|
|||
|
|||
class TestQifFile(TransactionCase): |
|||
"""Tests for import bank statement qif file format (account.bank.statement.import) |
|||
"""Tests for import bank statement qif file format |
|||
(account.bank.statement.import) |
|||
""" |
|||
|
|||
def setUp(self): |
|||
super(TestQifFile, self).setUp() |
|||
self.statement_import_model = self.registry('account.bank.statement.import') |
|||
self.bank_statement_model = self.registry('account.bank.statement') |
|||
self.bank_statement_line_model = self.registry('account.bank.statement.line') |
|||
self.statement_import_model = self.env['account.bank.statement.import'] |
|||
self.statement_line_model = self.env['account.bank.statement.line'] |
|||
|
|||
def test_qif_file_import(self): |
|||
from openerp.tools import float_compare |
|||
cr, uid = self.cr, self.uid |
|||
qif_file_path = get_module_resource('account_bank_statement_import_qif', 'test_qif_file', 'test_qif.qif') |
|||
qif_file_path = get_module_resource( |
|||
'account_bank_statement_import_qif', |
|||
'test_qif_file', 'test_qif.qif') |
|||
qif_file = open(qif_file_path, 'rb').read().encode('base64') |
|||
bank_statement_id = self.statement_import_model.create(cr, uid, dict( |
|||
data_file=qif_file, |
|||
)) |
|||
context = { |
|||
'journal_id': self.registry('ir.model.data').get_object_reference(cr, uid, 'account', 'bank_journal')[1] |
|||
} |
|||
self.statement_import_model.import_file(cr, uid, [bank_statement_id], context=context) |
|||
line_id = self.bank_statement_line_model.search(cr, uid, [('name', '=', 'YOUR LOCAL SUPERMARKET')])[0] |
|||
statement_id = self.bank_statement_line_model.browse(cr, uid, line_id).statement_id.id |
|||
bank_st_record = self.bank_statement_model.browse(cr, uid, statement_id) |
|||
assert float_compare(bank_st_record.balance_end_real, -1896.09, 2) == 0 |
|||
bank_statement_improt = self.statement_import_model.with_context( |
|||
journal_id=self.ref('account.bank_journal')).create( |
|||
dict(data_file=qif_file)) |
|||
bank_statement_improt.import_file() |
|||
bank_statement = self.statement_line_model.search( |
|||
[('name', '=', 'YOUR LOCAL SUPERMARKET')], limit=1)[0].statement_id |
|||
assert float_compare(bank_statement.balance_end_real, -1896.09, 2) == 0 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue