Commit 73452856 by François C.

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# IPython Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# virtualenv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
Odoo mutualization
============
That repository aims to handle a commom Odoo code for the food coops that take part in the mutualization (and found it).
Our code if free, so that coops don't want to fit in the previsous rules can freely fork this Github repository. However, we higly encourage then to not fork the common modules. In that case it would be very difficult for them to entrer in the mutualization in the future.
Repository organization
============
For maintenability purpose, all the coop have to use the same version of commun module. Thos modules are in odoo, extrat_addons and coop_addons folders.
In addition, each coop has a dedicated folder where she can build custom modules. Those modules don't have to make conflict with the common modules.
Changes proposal on common modules
============
The main collaboration process is quite simple. However, we have to experience it in order to imporve it :
* If someone want to change common module, make a PR against the dev branch. The repo management team will challenge it and if it's good, merge it. Do not forbid migration scripts.
* If someone want to build a custom module, make a PR against the dev branch. The repo management team will merge in whintin 2 days. You will get it on the production/9.0 branch on the next dev->9.0 merge (ask if its urgent).
For consistency reason, we prefer to ask to or dev supplier to make the modifications on common modules.
Upgrading process
============
Step A : on the DEV environnement
-------------
=> Developper for or repo and creates a branch from our 9.0 (production) branch
=> Developper commit changes on his own repo
=> Developper make a PR to the DEV branch : he adds to the description :
- a link to the ticket (and he adds the link of the PR to the ticket)
- the module name we have to update
- the module name we have to install
He adds the PR link to the TMS ticket.
=> The repo management team checks the code, and merge the PR against DEV branch
=> The hosting team update the code on staging instance, restore the lastest nighly DB copy, install/uninstall/update module dans execute migration scripts. They set the ticket to "on dev" status and send a message to users to describe the changes (basicly a screenshot of the ticket list that have be solved).
Step B : on the PROD environnement
-------------
Once the test are conpleted, the repo management team merge DEV -> 9.0 (production branch).
=> The hosting team update the code on staging instance, install/uninstall/update module dans execute migration scripts. They set the ticket to "on prod" status and send a message to users to describe the changes (basicly a screenshot of the ticket list that have be solved).
=> If the module is generic (inside the OCA repository), the developper create a PR against OCA repo
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Account Bank Statement Import
=============================
CAUTION: this module was renamed in the 9.0 branch to avoid conflicts with the
upstream account_bank_statement_import module added in odoo 9. Exercise caution
when porting.
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.
# -*- encoding: utf-8 -*-
{
'name': 'Account Bank Statement Import',
'category': 'Banking addons',
'version': '8.0.1.0.1',
'author': 'OpenERP SA,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/bank-statement-import',
'depends': ['account'],
'data': [
"views/account_config_settings.xml",
'views/account_bank_statement_import_view.xml',
],
'demo': [
'demo/fiscalyear_period.xml',
'demo/partner_bank.xml',
],
'auto_install': False,
# CAUTION: this module was renamed in the 9.0 branch to avoid conflicts with the
# upstream account_bank_statement_import module added in odoo 9. Exercise caution
# when porting.
'installable': False,
}
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Fiscal year
-->
<record id="data_fiscalyear_2013" model="account.fiscalyear">
<field eval="'Fiscal Year X 2013'" name="name"/>
<field eval="'FY2013'" name="code"/>
<field eval="'2013-01-01'" name="date_start"/>
<field eval="'2013-12-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<!--
Fiscal Periods 2013
-->
<record id="period_1_2013" model="account.period">
<field eval="'01/2013'" name="code"/>
<field eval="'X 01/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-01-01'" name="date_start"/>
<field eval="'2013-01-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_2_2013" model="account.period">
<field eval="'02/2013'" name="code"/>
<field eval="'X 02/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-02-01'" name="date_start"/>
<field eval="'2013-02-28'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_3_2013" model="account.period">
<field eval="'03/2013'" name="code"/>
<field eval="'X 03/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-03-01'" name="date_start"/>
<field eval="'2013-03-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_4_2013" model="account.period">
<field eval="'04/2013'" name="code"/>
<field eval="'X 04/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-04-01'" name="date_start"/>
<field eval="'2013-04-30'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_5_2013" model="account.period">
<field eval="'05/2013'" name="code"/>
<field eval="'X 05/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-05-01'" name="date_start"/>
<field eval="'2013-05-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_6_2013" model="account.period">
<field eval="'06/2013'" name="code"/>
<field eval="'X 06/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-06-01'" name="date_start"/>
<field eval="'2013-06-30'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_7_2013" model="account.period">
<field eval="'07/2013'" name="code"/>
<field eval="'X 07/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-07-01'" name="date_start"/>
<field eval="'2013-07-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_8_2013" model="account.period">
<field eval="'08/2013'" name="code"/>
<field eval="'X 08/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-08-01'" name="date_start"/>
<field eval="'2013-08-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_9_2013" model="account.period">
<field eval="'09/2013'" name="code"/>
<field eval="'X 09/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-09-01'" name="date_start"/>
<field eval="'2013-09-30'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_10_2013" model="account.period">
<field eval="'10/2013'" name="code"/>
<field eval="'X 10/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-10-01'" name="date_start"/>
<field eval="'2013-10-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_11_2013" model="account.period">
<field eval="'11/2013'" name="code"/>
<field eval="'X 11/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-11-01'" name="date_start"/>
<field eval="'2013-11-30'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_12_2013" model="account.period">
<field eval="'12/2013'" name="code"/>
<field eval="'X 12/2013'" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear_2013"/>
<field eval="'2013-12-01'" name="date_start"/>
<field eval="'2013-12-31'" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
</data>
</openerp>
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="ofx_partner_bank_1" model="res.partner.bank">
<field name="owner_name">Agrolait</field>
<field name="acc_number">00987654319</field>
<field name="partner_id" ref="base.res_partner_2"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
<record id="ofx_partner_bank_2" model="res.partner.bank">
<field name="owner_name">China Export</field>
<field name="acc_number">00987654322</field>
<field name="partner_id" ref="base.res_partner_3"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
<record id="qif_partner_bank_1" model="res.partner.bank">
<field name="owner_name">Delta PC</field>
<field name="acc_number">10987654320</field>
<field name="partner_id" ref="base.res_partner_4"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
<record id="qif_partner_bank_2" model="res.partner.bank">
<field name="owner_name">Epic Technologies</field>
<field name="acc_number">10987654322</field>
<field name="partner_id" ref="base.res_partner_5"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
</data>
</openerp>
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-03 22:47+0000\n"
"PO-Revision-Date: 2015-10-01 11:07+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:355
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr "%d transacciones han sido ya importadas y se omitirán."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:358
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr "1 transacción ha sido ya importada y se omitirá."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "1. Download your bank statements from your bank website."
msgstr "1. Descargue los extractos bancarios del sitio web de su banco."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid ""
"2. Make sure you have installed the right module to support the file format."
msgstr "2. Asegúrese de que ha instalado el módulo adecuado que soporte el formato de archivo."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "3. Select the file and click 'Import'."
msgstr "3. Seleccione el archivo y pulse 'Importar'."
#. module: account_bank_statement_import
#: sql_constraint:account.bank.statement.line:0
msgid "A bank account transactions can be imported only once !"
msgstr "Las transacciones de una cuenta bancaria sólo se pueden importar una vez"
#. module: account_bank_statement_import
#: 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
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:361
#, python-format
msgid "Already imported items"
msgstr "Elementos ya importados"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_res_partner_bank
msgid "Bank Accounts"
msgstr ""
#. module: account_bank_statement_import
#: field:account.bank.statement.import,data_file:0
msgid "Bank Statement File"
msgstr "Archivo de extracto bancario"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Línea de extracto bancario"
#. module: account_bank_statement_import
#: view:account.config.settings:account_bank_statement_import.view_account_config_settings
msgid "Bank statement import"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:120
#, python-format
msgid "Can not determine journal for import."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:114
#, python-format
msgid "Can not find the account number %s."
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr "Cancelar"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:158
#, python-format
msgid ""
"Could not make sense of the given file.\n"
"Did you install the module to support this type of file?"
msgstr ""
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_uid:0
msgid "Created by"
msgstr "Creado por"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_date:0
msgid "Created on"
msgstr "Creado en"
#. module: account_bank_statement_import
#: field:account.config.settings,module_base_bank_account_number_unique:0
msgid "Enforce unique account numbers on bank accounts"
msgstr ""
#. module: account_bank_statement_import
#: help:account.bank.statement.import,data_file:0
msgid ""
"Get you bank statements in electronic format from your bank and select them "
"here."
msgstr "Obtenga los extractos bancarios en formato electrónico de su banco y selecciónelos aquí."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "How to import your bank statement :"
msgstr "Cómo importar su extracto bancario:"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,id:0
msgid "ID"
msgstr "ID"
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import"
msgstr ""
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar extracto bancario"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Import Bank Statements"
msgstr "Importar extractos bancarios"
#. module: account_bank_statement_import
#: field:account.bank.statement.line,unique_import_id:0
msgid "Import ID"
msgstr "Importar ID"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,journal_id:0
msgid "Journal"
msgstr ""
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_uid:0
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_date:0
msgid "Last Updated on"
msgstr "Última actualización en"
#. module: account_bank_statement_import
#: field:res.partner.bank,sanitized_acc_number:0
msgid "Sanitized Account Number"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:242
#, python-format
msgid "Statement currency id is %d, but company currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:228
#, python-format
msgid "Statement currency id is %d, but journal currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:183
#, python-format
msgid "Statement has invalid currency code %s"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:211
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr "La cuenta de este extracto está enlazada a otro diario."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:247
#, python-format
msgid ""
"The currency of the bank statement is not the same as the company currency !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:233
#, python-format
msgid ""
"The currency of the bank statement is not the same as the currency of the "
"journal !"
msgstr "La moneda del extracto bancario no es la misma que la moneda del diario."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:167
#, python-format
msgid "This file doesn't contain any statement."
msgstr "Este archivo no contiene ningún extracto."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:172
#, python-format
msgid "This file doesn't contain any transaction."
msgstr "Este archivo no contiene ninguna transacción."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:99
#, python-format
msgid "You have already imported that file."
msgstr "Ya ha importado este archivo."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "_Import"
msgstr "Importar"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "or"
msgstr "o"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import
#
# Translators:
# Florian Hatat, 2015
# Florian Hatat, 2015
# Guewen Baconnier <guewen.baconnier@camptocamp.com>, 2015
# zuher83 <zuher.elmas@gmail.com>, 2015
# zuher83 <zuher.elmas@gmail.com>, 2015
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-03 22:47+0000\n"
"PO-Revision-Date: 2015-10-01 11:07+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:355
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr "%d mouvements déjà importés ont été ignorés."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:358
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr "1 mouvement déjà importé a été ignoré."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "1. Download your bank statements from your bank website."
msgstr "1. Téléchargez vos relevés de comptes depuis le site internet de votre banque."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid ""
"2. Make sure you have installed the right module to support the file format."
msgstr "2. Vérifiez que vous avez bien installé le module compatible avec le format de fichier à importer."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "3. Select the file and click 'Import'."
msgstr "3. Sélectionnez le fichier et cliquez sur \"Importer\". "
#. module: account_bank_statement_import
#: sql_constraint:account.bank.statement.line:0
msgid "A bank account transactions can be imported only once !"
msgstr "Les transactions peuvent être importées en une seule fois !"
#. module: account_bank_statement_import
#: 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
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:361
#, python-format
msgid "Already imported items"
msgstr "Lignes déjà importées"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_res_partner_bank
msgid "Bank Accounts"
msgstr "Comptes Bancaire"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,data_file:0
msgid "Bank Statement File"
msgstr "Fichier de Relevé Bancaire"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Ligne de Relevé Bancaire"
#. module: account_bank_statement_import
#: view:account.config.settings:account_bank_statement_import.view_account_config_settings
msgid "Bank statement import"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:120
#, python-format
msgid "Can not determine journal for import."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:114
#, python-format
msgid "Can not find the account number %s."
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr "Annuler"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:158
#, python-format
msgid ""
"Could not make sense of the given file.\n"
"Did you install the module to support this type of file?"
msgstr ""
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_uid:0
msgid "Created by"
msgstr "Créé par "
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_date:0
msgid "Created on"
msgstr "Créé le "
#. module: account_bank_statement_import
#: field:account.config.settings,module_base_bank_account_number_unique:0
msgid "Enforce unique account numbers on bank accounts"
msgstr ""
#. module: account_bank_statement_import
#: help:account.bank.statement.import,data_file:0
msgid ""
"Get you bank statements in electronic format from your bank and select them "
"here."
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "How to import your bank statement :"
msgstr "Comment importe votre relevé bancaire :"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,id:0
msgid "ID"
msgstr "ID"
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import"
msgstr "Import"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importer Relevé Bancaire"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Import Bank Statements"
msgstr "Importer Relevés Bancaire"
#. module: account_bank_statement_import
#: field:account.bank.statement.line,unique_import_id:0
msgid "Import ID"
msgstr "Id Import"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,journal_id:0
msgid "Journal"
msgstr "Journal"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_uid:0
msgid "Last Updated by"
msgstr "Dernière mise à jour par "
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_date:0
msgid "Last Updated on"
msgstr "Dernière mise à jour le "
#. module: account_bank_statement_import
#: field:res.partner.bank,sanitized_acc_number:0
msgid "Sanitized Account Number"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:242
#, python-format
msgid "Statement currency id is %d, but company currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:228
#, python-format
msgid "Statement currency id is %d, but journal currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:183
#, python-format
msgid "Statement has invalid currency code %s"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:211
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr "Le numéro de compte de ce relevé correspond à un autre journal."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:247
#, python-format
msgid ""
"The currency of the bank statement is not the same as the company currency !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:233
#, python-format
msgid ""
"The currency of the bank statement is not the same as the currency of the "
"journal !"
msgstr "La monnaie du relevé bancaire à importer ne correspond pas à la monnaie du journal !"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:167
#, python-format
msgid "This file doesn't contain any statement."
msgstr "Ce fichier ne comporte aucun relevé."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:172
#, python-format
msgid "This file doesn't contain any transaction."
msgstr "Ce fichier ne comporte aucune transaction."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:99
#, python-format
msgid "You have already imported that file."
msgstr "Vous avez déjà importé ce fichier."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "_Import"
msgstr "_Import"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "or"
msgstr "ou"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-02-20 00:25+0000\n"
"PO-Revision-Date: 2015-02-20 00:25+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
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:269
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr "%d Pervedimai buvo ignoruoti, nes jie jau importuoti."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:269
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr "1 pervedimas buvo ignoruotas, nes jis jau importuotas."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "1. Download your bank statements from your bank website."
msgstr "1. Atsisiųskite banko sąskaitų išrašus iš banko internetinės svetainės."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "2. Make sure you have installed the right module to support the file format."
msgstr "2. Įsitikinkit, jog esate įrašę tinkamą modulį kuris palaikytų banko išrašo formatą."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "3. Select the file and click 'Import'."
msgstr "3. Nurodykite failą ir spauskite 'Importuoti'."
#. module: account_bank_statement_import
#: sql_constraint:account.bank.statement.line:0
msgid "A bank account transactions can be imported only once !"
msgstr "Banko sąskaitos operacijos gali būti importuojamos tik vieną kartą !"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:271
#, python-format
msgid "Already imported items"
msgstr "Įrašai jau importuoti"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:182
#, python-format
msgid "Bank"
msgstr "Bankas"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,data_file:0
msgid "Bank Statement File"
msgstr "Banko išrašo failas"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Banko išrašo eilutė"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr "Atšaukti"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:169
#, python-format
msgid "Cannot find in which journal import this statement. Please manually select a journal.
msgstr "Žurnalas, į kurį norite importuoti šį išrašą, nerastas. Pasirinkite žurnalą rankiniu būdu."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:99
#, python-format
msgid "Could not make sense of the given file.\n"
"Did you install the module to support this type of file ?"
msgstr "Failas, kurį nurodėte, netinka.\n"
"Ar Jūs įrašėte tinkamą modulį, kad palaikytų šį failų formatą?"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_uid:0
msgid "Created by"
msgstr "Sukūrė"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_date:0
msgid "Created on"
msgstr "Sukurta"
#. module: account_bank_statement_import
#: help:account.bank.statement.import,data_file:0
msgid "Get you bank statements in electronic format from your bank and select them here."
msgstr "Atsisiuntę banko sąskaitos išrašą elektroniniu formatu, pasirinkite jį čia."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "How to import your bank statement :"
msgstr "Kaip importuoti banko sąskaitos išrašą :"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,id:0
msgid "ID"
msgstr "ID"
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Banko išrašo importas"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Import Bank Statements"
msgstr "Banko išrašo importas"
#. module: account_bank_statement_import
#: field:account.bank.statement.line,unique_import_id:0
msgid "Import ID"
msgstr "Importuoti ID"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_uid:0
msgid "Last Updated by"
msgstr "Paskutinį kartą atnaujino"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_date:0
msgid "Last Updated on"
msgstr "Paskutinį kartą atnaujinta"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:146
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr "Šio išrašo banko sąskaita yra susieta su kitu žurnalu."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:157
#, python-format
msgid "The currency of the bank statement is not the same as the currency of the journal !"
msgstr "Banko sąskaitos išrašo valiuta skiriasi nuo pasirinkto žurnalo valiutos !"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:104
#, python-format
msgid "This file doesn't contain any statement."
msgstr "Šiame faile nėra jokių banko sąskaitos išrašų."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:112
#, python-format
msgid "This file doesn't contain any transaction."
msgstr "Šiame faile nėra jokių operacijų."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/account_bank_statement_import.py:261
#, python-format
msgid "You have already imported that file."
msgstr "Jūs jau importavote šį failą."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "_Import"
msgstr "_Importuoti"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "or"
msgstr "arba"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import
#
# Translators:
# Arminas Grigonis <arminas@versada.lt>, 2015
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-03 22:47+0000\n"
"PO-Revision-Date: 2015-10-01 11:07+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Lithuanian (Lithuania) (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/lt_LT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: lt_LT\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:355
#, python-format
msgid "%d transactions had already been imported and were ignored."
msgstr "%d transakcijos ignoruotos, nes jau buvo importuotos."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:358
#, python-format
msgid "1 transaction had already been imported and was ignored."
msgstr "1 transakcija ignoruota, nes jau buvo importuota."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "1. Download your bank statements from your bank website."
msgstr "1. Atsisiųskite savo banko sąskaitos išrašus iš savo banko svetainės."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid ""
"2. Make sure you have installed the right module to support the file format."
msgstr "2. Įsitikinkte, kad įrašėte tinkamą modulį, kuris palaikytų šį failų formatą."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "3. Select the file and click 'Import'."
msgstr "3. Pasirinkite failą ir spauskite 'Importuoti'."
#. module: account_bank_statement_import
#: sql_constraint:account.bank.statement.line:0
msgid "A bank account transactions can be imported only once !"
msgstr "Banko sąskaitos išrašai gali būti importuoti tik vieną kartą!"
#. module: account_bank_statement_import
#: 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 "Sąskaitos žurnalas susijęs su banko išrašu, kurį jūs importuojate. Jis turi būti rankiniu būdu pasirinktas išrašų formatams, kurių sistema pati neaptinka (pvz. QIF)"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:361
#, python-format
msgid "Already imported items"
msgstr "Importuoti įrašai"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_res_partner_bank
msgid "Bank Accounts"
msgstr "Banko sąskaitos"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,data_file:0
msgid "Bank Statement File"
msgstr "Banko išrašo failas"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Banko išrašo eilutė"
#. module: account_bank_statement_import
#: view:account.config.settings:account_bank_statement_import.view_account_config_settings
msgid "Bank statement import"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:120
#, python-format
msgid "Can not determine journal for import."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:114
#, python-format
msgid "Can not find the account number %s."
msgstr ""
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Cancel"
msgstr "Atšaukti"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:158
#, python-format
msgid ""
"Could not make sense of the given file.\n"
"Did you install the module to support this type of file?"
msgstr ""
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_uid:0
msgid "Created by"
msgstr "Sukūrė"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,create_date:0
msgid "Created on"
msgstr "Sukurta"
#. module: account_bank_statement_import
#: field:account.config.settings,module_base_bank_account_number_unique:0
msgid "Enforce unique account numbers on bank accounts"
msgstr ""
#. module: account_bank_statement_import
#: help:account.bank.statement.import,data_file:0
msgid ""
"Get you bank statements in electronic format from your bank and select them "
"here."
msgstr "Gaukite savo banko išrašus elektronine forma ir pasirinkite juos čia."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "How to import your bank statement :"
msgstr "Kaip importuoti banko išrašą :"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,id:0
msgid "ID"
msgstr "ID"
#. module: account_bank_statement_import
#: model:ir.actions.act_window,name:account_bank_statement_import.action_account_bank_statement_import
#: model:ir.ui.menu,name:account_bank_statement_import.menu_account_bank_statement_import
msgid "Import"
msgstr "Importuoti"
#. module: account_bank_statement_import
#: model:ir.model,name:account_bank_statement_import.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importuoti banko išrašą"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "Import Bank Statements"
msgstr "Importuoti banko išrašus"
#. module: account_bank_statement_import
#: field:account.bank.statement.line,unique_import_id:0
msgid "Import ID"
msgstr "Importuoti ID"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,journal_id:0
msgid "Journal"
msgstr "Žurnalas"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_uid:0
msgid "Last Updated by"
msgstr "Paskutinį kartą atnaujino"
#. module: account_bank_statement_import
#: field:account.bank.statement.import,write_date:0
msgid "Last Updated on"
msgstr "Paskutinį kartą atnaujinta"
#. module: account_bank_statement_import
#: field:res.partner.bank,sanitized_acc_number:0
msgid "Sanitized Account Number"
msgstr "Išbraukytas sąskaitos numeris"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:242
#, python-format
msgid "Statement currency id is %d, but company currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:228
#, python-format
msgid "Statement currency id is %d, but journal currency id = %d."
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:183
#, python-format
msgid "Statement has invalid currency code %s"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:211
#, python-format
msgid "The account of this statement is linked to another journal."
msgstr "Šio išrašo sąskaita yra susieta su kitu žurnalu."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:247
#, python-format
msgid ""
"The currency of the bank statement is not the same as the company currency !"
msgstr ""
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:233
#, python-format
msgid ""
"The currency of the bank statement is not the same as the currency of the "
"journal !"
msgstr "Banko išrašo valiuta skiriasi nuo žurnalo valiutos !"
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:167
#, python-format
msgid "This file doesn't contain any statement."
msgstr "Faile nerasta jokių išrašų."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:172
#, python-format
msgid "This file doesn't contain any transaction."
msgstr "Faile nėra jokių pavedimų."
#. module: account_bank_statement_import
#: code:addons/account_bank_statement_import/models/account_bank_statement_import.py:99
#, python-format
msgid "You have already imported that file."
msgstr "Jūs jau importavote šį failą."
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "_Import"
msgstr "_Importuoti"
#. module: account_bank_statement_import
#: view:account.bank.statement.import:account_bank_statement_import.account_bank_statement_import_view
msgid "or"
msgstr "arba"
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
def migrate(cr, version):
# if we end up here, we migrate from 7.0's account_banking
# set transaction ids, taking care to enforce uniqueness
cr.execute(
"""update account_bank_statement_line l set unique_import_id=l1.trans
from (
select distinct
first_value(id) over (partition by trans) id, trans
from account_bank_statement_line
) l1
where l.id=l1.id""")
# -*- encoding: utf-8 -*-
from . import res_partner_bank
from . import account_bank_statement_import
from . import account_config_settings
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields
class AccountConfigSettings(models.TransientModel):
_inherit = 'account.config.settings'
module_base_bank_account_number_unique = fields.Boolean(
'Enforce unique account numbers on bank accounts')
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_bank_statement_import,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_bank_statement_importis free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# account_bank_statement_import is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with account_bank_statement_import_coda.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import re
from openerp import api, models, fields
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
sanitized_acc_number = fields.Char(
'Sanitized Account Number', size=64, readonly=True,
compute='_get_sanitized_account_number', store=True, index=True)
def _sanitize_account_number(self, acc_number):
if acc_number:
return re.sub(r'\W+', '', acc_number).upper()
return False
@api.one
@api.depends('acc_number')
def _get_sanitized_account_number(self):
self.sanitized_acc_number = self._sanitize_account_number(
self.acc_number)
@api.returns('self')
def search(self, cr, user, args, offset=0, limit=None, order=None,
context=None, count=False):
pos = 0
while pos < len(args):
if args[pos][0] == 'acc_number':
op = args[pos][1]
value = args[pos][2]
if hasattr(value, '__iter__'):
value = [self._sanitize_account_number(i) for i in value]
else:
value = self._sanitize_account_number(value)
if 'like' in op:
value = '%' + value + '%'
args[pos] = ('sanitized_acc_number', op, value)
pos += 1
return super(ResPartnerBank, self).search(
cr, user, args, offset=offset, limit=limit, order=order,
context=context, count=count)
# -*- encoding: utf-8 -*-
"""Classes and definitions used in parsing bank statements."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
class BankTransaction(dict):
"""Single transaction that is part of a bank statement."""
@property
def value_date(self):
"""property getter"""
return self['date']
@value_date.setter
def value_date(self, value_date):
"""property setter"""
self['date'] = value_date
@property
def name(self):
"""property getter"""
return self['name']
@name.setter
def name(self, name):
"""property setter"""
self['name'] = name
@property
def transferred_amount(self):
"""property getter"""
return self['amount']
@transferred_amount.setter
def transferred_amount(self, transferred_amount):
"""property setter"""
self['amount'] = transferred_amount
@property
def eref(self):
"""property getter"""
return self['ref']
@eref.setter
def eref(self, eref):
"""property setter"""
self['ref'] = eref
if not self.message:
self.name = eref
@property
def message(self):
"""property getter"""
return self._message
@message.setter
def message(self, message):
"""property setter"""
self._message = message
self.name = message
@property
def remote_owner(self):
"""property getter"""
return self['partner_name']
@remote_owner.setter
def remote_owner(self, remote_owner):
"""property setter"""
self['partner_name'] = remote_owner
if not (self.message or self.eref):
self.name = remote_owner
@property
def remote_account(self):
"""property getter"""
return self['account_number']
@remote_account.setter
def remote_account(self, remote_account):
"""property setter"""
self['account_number'] = remote_account
@property
def note(self):
return self['note']
@note.setter
def note(self, note):
self['note'] = note
def __init__(self):
"""Define and initialize attributes.
Not all attributes are already used in the actual import.
"""
super(BankTransaction, self).__init__()
self.transfer_type = False # Action type that initiated this message
self.execution_date = False # The posted date of the action
self.value_date = False # The value date of the action
self.remote_account = False # The account of the other party
self.remote_currency = False # The currency used by the other party
self.exchange_rate = 0.0
# The exchange rate used for conversion of local_currency and
# remote_currency
self.transferred_amount = 0.0 # actual amount transferred
self.name = ''
self._message = False # message from the remote party
self.eref = False # end to end reference for transactions
self.remote_owner = False # name of the other party
self.remote_owner_address = [] # other parties address lines
self.remote_owner_city = False # other parties city name
self.remote_owner_postalcode = False # other parties zip code
self.remote_owner_country_code = False # other parties country code
self.remote_bank_bic = False # bic of other party's bank
self.provision_costs = False # costs charged by bank for transaction
self.provision_costs_currency = False
self.provision_costs_description = False
self.error_message = False # error message for interaction with user
self.storno_retry = False
# If True, make cancelled debit eligible for a next direct debit run
self.data = '' # Raw data from which the transaction has been parsed
class BankStatement(dict):
"""A bank statement groups data about several bank transactions."""
@property
def statement_id(self):
"""property getter"""
return self['name']
def _set_transaction_ids(self):
"""Set transaction ids to statement_id with sequence-number."""
subno = 0
for transaction in self['transactions']:
subno += 1
transaction['unique_import_id'] = (
self.statement_id + str(subno).zfill(4))
@statement_id.setter
def statement_id(self, statement_id):
"""property setter"""
self['name'] = statement_id
self._set_transaction_ids()
@property
def local_account(self):
"""property getter"""
return self['account_number']
@local_account.setter
def local_account(self, local_account):
"""property setter"""
self['account_number'] = local_account
@property
def local_currency(self):
"""property getter"""
return self['currency_code']
@local_currency.setter
def local_currency(self, local_currency):
"""property setter"""
self['currency_code'] = local_currency
@property
def start_balance(self):
"""property getter"""
return self['balance_start']
@start_balance.setter
def start_balance(self, start_balance):
"""property setter"""
self['balance_start'] = start_balance
@property
def end_balance(self):
"""property getter"""
return self['balance_end']
@end_balance.setter
def end_balance(self, end_balance):
"""property setter"""
self['balance_end'] = end_balance
self['balance_end_real'] = end_balance
@property
def date(self):
"""property getter"""
return self['date']
@date.setter
def date(self, date):
"""property setter"""
self['date'] = date
def create_transaction(self):
"""Create and append transaction.
This should only be called after statement_id has been set, because
statement_id will become part of the unique transaction_id.
"""
transaction = BankTransaction()
self['transactions'].append(transaction)
# Fill default id, but might be overruled
transaction['unique_import_id'] = (
self.statement_id + str(len(self['transactions'])).zfill(4))
return transaction
def __init__(self):
super(BankStatement, self).__init__()
self['transactions'] = []
self.statement_id = ''
self.local_account = ''
self.local_currency = ''
self.date = ''
self.start_balance = 0.0
self.end_balance = 0.0
# -*- encoding: utf-8 -*-
"""Define tests to be run."""
from . import test_res_partner_bank
from . import test_import_bank_statement
from .test_import_file import TestStatementFile
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_bank_statement_import,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_bank_statement_import is free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# account_bank_statement_import is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with account_bank_statement_import_coda.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.tests.common import TransactionCase
from openerp.exceptions import Warning
class TestAccountBankStatementImport(TransactionCase):
"""Tests for import bank statement file import
(account.bank.statement.import)
"""
def setUp(self):
super(TestAccountBankStatementImport, self).setUp()
self.statement_import_model = self.env[
'account.bank.statement.import']
self.account_journal_model = self.env['account.journal']
self.res_users_model = self.env['res.users']
self.journal_id = self.ref('account.bank_journal')
self.base_user_root_id = self.ref('base.user_root')
self.base_user_root = self.res_users_model.browse(
self.base_user_root_id)
# create a new user that belongs to the same company as
# user_root
self.other_partner_id = self.env['res.partner'].create(
{"name": "My other partner",
"is_company": False,
"email": "test@tes.ttest",
})
self.company_id = self.base_user_root.company_id.id
self.other_user_id_a = self.res_users_model.create(
{"partner_id": self.other_partner_id.id,
"company_id": self.company_id,
"company_ids": [(4, self.company_id)],
"login": "my_login a",
"name": "my user",
"groups_id": [(4, self.ref('account.group_account_manager'))]
})
def test_import_preconditions(self):
"""Checks that the import raises an exception if:
* no bank account found for the account_number
* no account_journal found on the bank_account
"""
stmt_vals = {
'currency_code': 'EUR',
'account_number': '123456789'}
with self.assertRaises(Warning) as e:
self.statement_import_model._import_statement(stmt_vals.copy())
self.assertEqual(e.exception.message,
'Can not find the account number 123456789.')
self.statement_import_model._create_bank_account('123456789')
with self.assertRaises(Warning) as e:
self.statement_import_model._import_statement(stmt_vals.copy())
self.assertEqual(e.exception.message,
'Can not determine journal for import.')
def test_create_bank_account(self):
"""Checks that the bank_account created by the import belongs to the
partner linked to the company of the provided journal
"""
journal = self.account_journal_model.browse(self.journal_id)
expected_id = journal.company_id.partner_id.id
st_import = self.statement_import_model.sudo(self.other_user_id_a.id)
bank = st_import._create_bank_account(
'001251882303', company_id=self.company_id)
self.assertEqual(bank.partner_id.id, expected_id)
# -*- coding: utf-8 -*-
"""Provide common base for bank statement import tests."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# All other contributions are (C) by their respective contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from openerp.tests.common import TransactionCase
from openerp.modules.module import get_module_resource
_logger = logging.getLogger(__name__)
class TestStatementFile(TransactionCase):
"""Check wether statements with transactions correctly imported.
No actual tests are done in this class, implementations are in
subclasses in actual import modules.
"""
def _test_transaction(
self, statement_obj, remote_account=False,
transferred_amount=False, value_date=False, ref=False):
"""Check wether transaction with attributes passed was created.
Actually this method also tests wether automatic creation of
partner bank accounts is working.
"""
transaction_model = self.env['account.bank.statement.line']
partner_bank_model = self.env['res.partner.bank']
domain = [('statement_id', '=', statement_obj.id)]
if remote_account:
bids = partner_bank_model.search(
[('acc_number', '=', remote_account)])
self.assertTrue(
bids,
'Bank-account %s not found after parse.' % remote_account
)
domain.append(('bank_account_id', '=', bids[0].id))
if transferred_amount:
domain.append(('amount', '=', transferred_amount))
if value_date:
domain.append(('date', '=', value_date))
if ref:
domain.append(('ref', '=', ref))
ids = transaction_model.search(domain)
if not ids:
# We will get assertion error, but to solve we need to see
# what transactions have been added:
self.cr.execute(
"select name, date, amount, ref, bank_account_id"
" from account_bank_statement_line"
" where statement_id=%d" % statement_obj.id)
_logger.error(
"Transaction not found in %s" %
str(self.cr.fetchall())
)
self.assertTrue(
ids,
'Transaction %s not found after parse.' % str(domain)
)
def _test_statement_import(
self, module_name, file_name, statement_name, local_account=False,
start_balance=False, end_balance=False, transactions=None):
"""Test correct creation of single statement."""
import_model = self.env['account.bank.statement.import']
partner_bank_model = self.env['res.partner.bank']
statement_model = self.env['account.bank.statement']
statement_path = get_module_resource(
module_name,
'test_files',
file_name
)
statement_file = open(
statement_path, 'rb').read().encode('base64')
bank_statement_id = import_model.create(
dict(
data_file=statement_file,
)
)
bank_statement_id.import_file()
# Check wether bank account has been created:
if local_account:
bids = partner_bank_model.search(
[('acc_number', '=', local_account)])
self.assertTrue(
bids,
'Bank account %s not created from statement' % local_account
)
# statement name is account number + '-' + date of last 62F line:
ids = statement_model.search([('name', '=', statement_name)])
self.assertTrue(
ids,
'Statement %s not found after parse.' % statement_name
)
statement_obj = ids[0]
if start_balance:
self.assertTrue(
abs(statement_obj.balance_start - start_balance) < 0.00001,
'Start balance %f not equal to expected %f' %
(statement_obj.balance_start, start_balance)
)
if end_balance:
self.assertTrue(
abs(statement_obj.balance_end_real - end_balance) < 0.00001,
'End balance %f not equal to expected %f' %
(statement_obj.balance_end_real, end_balance)
)
# Maybe we need to test transactions?
if transactions:
for transaction in transactions:
self._test_transaction(statement_obj, **transaction)
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of account_bank_statement_import,
# an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_bank_statement_import is free software:
# you can redistribute it and/or modify it under the terms of the GNU
# Affero General Public License as published by the Free Software
# Foundation,either version 3 of the License, or (at your option) any
# later version.
#
# account_bank_statement_import is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with account_bank_statement_import_coda.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.tests.common import TransactionCase
class TestResPartnerBank(TransactionCase):
"""Tests acc_number
"""
def test_sanitized_acc_number(self):
partner_bank_model = self.env['res.partner.bank']
acc_number = " BE-001 2518823 03 "
vals = partner_bank_model.search([('acc_number', '=', acc_number)])
self.assertEquals(0, len(vals))
partner_bank = partner_bank_model.create({
'acc_number': acc_number,
'partner_id': self.ref('base.res_partner_2'),
'state': 'bank',
})
vals = partner_bank_model.search([('acc_number', '=', acc_number)])
self.assertEquals(1, len(vals))
self.assertEquals(partner_bank, vals[0])
vals = partner_bank_model.search([('acc_number', 'in', [acc_number])])
self.assertEquals(1, len(vals))
self.assertEquals(partner_bank, vals[0])
self.assertEqual(partner_bank.acc_number, acc_number)
# sanitaze the acc_number
sanitized_acc_number = 'BE001251882303'
vals = partner_bank_model.search(
[('acc_number', '=', sanitized_acc_number)])
self.assertEquals(1, len(vals))
self.assertEquals(partner_bank, vals[0])
vals = partner_bank_model.search(
[('acc_number', 'in', [sanitized_acc_number])])
self.assertEquals(1, len(vals))
self.assertEquals(partner_bank, vals[0])
self.assertEqual(partner_bank.sanitized_acc_number,
sanitized_acc_number)
# search is case insensitive
vals = partner_bank_model.search(
[('acc_number', '=', sanitized_acc_number.lower())])
self.assertEquals(1, len(vals))
vals = partner_bank_model.search(
[('acc_number', '=', acc_number.lower())])
self.assertEquals(1, len(vals))
<?xml version="1.0" ?>
<openerp>
<data>
<record id="account_bank_statement_import_view" model="ir.ui.view">
<field name="name">Import Bank Statements</field>
<field name="model">account.bank.statement.import</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Import Bank Statements">
<field name="data_file"/>
<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'}"/>
<br/><br/><b> How to import your bank statement :</b>
<br/><label string= "1. Download your bank statements from your bank website."/>
<br/><label string= "2. Make sure you have installed the right module to support the file format."/>
<br/><label string= "3. Select the file and click 'Import'."/>
<footer>
<button name="import_file" string="_Import" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_bank_statement_import" model="ir.actions.act_window">
<field name="name">Import</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement.import</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="account_bank_statement_import_view"/>
</record>
<menuitem id="menu_account_bank_statement_import" parent="account.menu_finance_bank_and_cash" action="action_account_bank_statement_import" sequence="8"/>
</data>
</openerp>
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_account_config_settings" model="ir.ui.view">
<field name="model">account.config.settings</field>
<field name="inherit_id" ref="account.view_account_config_settings" />
<field name="arch" type="xml">
<xpath expr="." position="inside">
<separator name="account_bank_statement_import" string="Bank statement import" />
<group>
<field name="module_base_bank_account_number_unique" />
</group>
</xpath>
</field>
</record>
</data>
</openerp>
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Bank Statement Parse Camt
=========================
Module to import SEPA CAMT.053 Format bank statement files.
Based on the Banking addons framework.
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
------------
* Stefan Rijnhart <srijnhart@therp.nl>
* 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.
This module should make it easy to migrate bank statement import
modules written for earlies versions of Odoo/OpenERP.
from . import account_bank_statement_import
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'CAMT Format Bank Statements Import',
'version': '8.0.0.3.0',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Therp BV',
'website': 'https://github.com/OCA/bank-statement-import',
'category': 'Banking addons',
'depends': [
'account_bank_statement_import',
],
'demo': [
'demo/demo_data.xml',
],
'installable': False,
}
# -*- coding: utf-8 -*-
"""Add process_camt method to account.bank.statement.import."""
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from openerp import models
from .camt import CamtParser as Parser
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
"""Add process_camt method to account.bank.statement.import."""
_inherit = 'account.bank.statement.import'
def _parse_file(self, cr, uid, data_file, context=None):
"""Parse a CAMT053 XML file."""
parser = Parser()
try:
_logger.debug("Try parsing with camt.")
return parser.parse(data_file)
except ValueError:
# Not a camt file, returning super will call next candidate:
_logger.debug("Statement file was not a camt file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)
# -*- coding: utf-8 -*-
"""Class to parse camt files."""
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import re
from datetime import datetime
from lxml import etree
from openerp.addons.account_bank_statement_import.parserlib import (
BankStatement)
class CamtParser(object):
"""Parser for camt bank statement import files."""
def parse_amount(self, ns, node):
"""Parse element that contains Amount and CreditDebitIndicator."""
if node is None:
return 0.0
sign = 1
amount = 0.0
sign_node = node.xpath('ns:CdtDbtInd', namespaces={'ns': ns})
if sign_node and sign_node[0].text == 'DBIT':
sign = -1
amount_node = node.xpath('ns:Amt', namespaces={'ns': ns})
if amount_node:
amount = sign * float(amount_node[0].text)
return amount
def add_value_from_node(
self, ns, node, xpath_str, obj, attr_name, join_str=None):
"""Add value to object from first or all nodes found with xpath.
If xpath_str is a list (or iterable), it will be seen as a series
of search path's in order of preference. The first item that results
in a found node will be used to set a value."""
if not isinstance(xpath_str, (list, tuple)):
xpath_str = [xpath_str]
for search_str in xpath_str:
found_node = node.xpath(search_str, namespaces={'ns': ns})
if found_node:
if join_str is None:
attr_value = found_node[0].text
else:
attr_value = join_str.join([x.text for x in found_node])
setattr(obj, attr_name, attr_value)
break
def parse_transaction_details(self, ns, node, transaction):
"""Parse transaction details (message, party, account...)."""
# message
self.add_value_from_node(
ns, node, [
'./ns:RmtInf/ns:Ustrd',
'./ns:AddtlTxInf',
'./ns:AddtlNtryInf',
], transaction, 'message')
# eref
self.add_value_from_node(
ns, node, [
'./ns:RmtInf/ns:Strd/ns:CdtrRefInf/ns:Ref',
'./ns:Refs/ns:EndToEndId',
],
transaction, 'eref'
)
# remote party values
party_type = 'Dbtr'
party_type_node = node.xpath(
'../../ns:CdtDbtInd', namespaces={'ns': ns})
if party_type_node and party_type_node[0].text != 'CRDT':
party_type = 'Cdtr'
party_node = node.xpath(
'./ns:RltdPties/ns:%s' % party_type, namespaces={'ns': ns})
if party_node:
self.add_value_from_node(
ns, party_node[0], './ns:Nm', transaction, 'remote_owner')
self.add_value_from_node(
ns, party_node[0], './ns:PstlAdr/ns:Ctry', transaction,
'remote_owner_country'
)
address_node = party_node[0].xpath(
'./ns:PstlAdr/ns:AdrLine', namespaces={'ns': ns})
if address_node:
transaction.remote_owner_address = [address_node[0].text]
# Get remote_account from iban or from domestic account:
account_node = node.xpath(
'./ns:RltdPties/ns:%sAcct/ns:Id' % party_type,
namespaces={'ns': ns}
)
if account_node:
iban_node = account_node[0].xpath(
'./ns:IBAN', namespaces={'ns': ns})
if iban_node:
transaction.remote_account = iban_node[0].text
bic_node = node.xpath(
'./ns:RltdAgts/ns:%sAgt/ns:FinInstnId/ns:BIC' % party_type,
namespaces={'ns': ns}
)
if bic_node:
transaction.remote_bank_bic = bic_node[0].text
else:
self.add_value_from_node(
ns, account_node[0], './ns:Othr/ns:Id', transaction,
'remote_account'
)
def parse_transaction(self, ns, node, transaction):
"""Parse transaction (entry) node."""
self.add_value_from_node(
ns, node, './ns:BkTxCd/ns:Prtry/ns:Cd', transaction,
'transfer_type'
)
self.add_value_from_node(
ns, node, './ns:BookgDt/ns:Dt', transaction, 'execution_date')
self.add_value_from_node(
ns, node, './ns:ValDt/ns:Dt', transaction, 'value_date')
transaction.transferred_amount = self.parse_amount(ns, node)
details_node = node.xpath(
'./ns:NtryDtls/ns:TxDtls', namespaces={'ns': ns})
if details_node:
self.parse_transaction_details(ns, details_node[0], transaction)
transaction.data = etree.tostring(node)
return transaction
def get_balance_amounts(self, ns, node):
"""Return opening and closing balance.
Depending on kind of balance and statement, the balance might be in a
different kind of node:
OPBD = OpeningBalance
PRCD = PreviousClosingBalance
ITBD = InterimBalance (first ITBD is start-, second is end-balance)
CLBD = ClosingBalance
"""
start_balance_node = None
end_balance_node = None
for node_name in ['OPBD', 'PRCD', 'CLBD', 'ITBD']:
code_expr = (
'./ns:Bal/ns:Tp/ns:CdOrPrtry/ns:Cd[text()="%s"]/../../..' %
node_name
)
balance_node = node.xpath(code_expr, namespaces={'ns': ns})
if balance_node:
if node_name in ['OPBD', 'PRCD']:
start_balance_node = balance_node[0]
elif node_name == 'CLBD':
end_balance_node = balance_node[0]
else:
if not start_balance_node:
start_balance_node = balance_node[0]
if not end_balance_node:
end_balance_node = balance_node[-1]
return (
self.parse_amount(ns, start_balance_node),
self.parse_amount(ns, end_balance_node)
)
def parse_statement(self, ns, node):
"""Parse a single Stmt node."""
statement = BankStatement()
self.add_value_from_node(
ns, node, [
'./ns:Acct/ns:Id/ns:IBAN',
'./ns:Acct/ns:Id/ns:Othr/ns:Id',
], statement, 'local_account'
)
self.add_value_from_node(
ns, node, './ns:Id', statement, 'statement_id')
self.add_value_from_node(
ns, node, './ns:Acct/ns:Ccy', statement, 'local_currency')
(statement.start_balance, statement.end_balance) = (
self.get_balance_amounts(ns, node))
transaction_nodes = node.xpath('./ns:Ntry', namespaces={'ns': ns})
for entry_node in transaction_nodes:
transaction = statement.create_transaction()
self.parse_transaction(ns, entry_node, transaction)
if statement['transactions']:
statement.date = datetime.strptime(
statement['transactions'][0].execution_date, "%Y-%m-%d")
return statement
def check_version(self, ns, root):
"""Validate validity of camt file."""
# Check wether it is camt at all:
re_camt = re.compile(
r'(^urn:iso:std:iso:20022:tech:xsd:camt.'
r'|^ISO:camt.)'
)
if not re_camt.search(ns):
raise ValueError('no camt: ' + ns)
# Check wether version 052 or 053:
re_camt_version = re.compile(
r'(^urn:iso:std:iso:20022:tech:xsd:camt.053.'
r'|^urn:iso:std:iso:20022:tech:xsd:camt.052.'
r'|^ISO:camt.053.'
r'|^ISO:camt.052.)'
)
if not re_camt_version.search(ns):
raise ValueError('no camt 052 or 053: ' + ns)
# Check GrpHdr element:
root_0_0 = root[0][0].tag[len(ns) + 2:] # strip namespace
if root_0_0 != 'GrpHdr':
raise ValueError('expected GrpHdr, got: ' + root_0_0)
def parse(self, data):
"""Parse a camt.052 or camt.053 file."""
try:
root = etree.fromstring(
data, parser=etree.XMLParser(recover=True))
except etree.XMLSyntaxError:
# ABNAmro is known to mix up encodings
root = etree.fromstring(
data.decode('iso-8859-15').encode('utf-8'))
if root is None:
raise ValueError(
'Not a valid xml file, or not an xml file at all.')
ns = root.tag[1:root.tag.index("}")]
self.check_version(ns, root)
statements = []
for node in root[0][1:]:
statement = self.parse_statement(ns, node)
if len(statement['transactions']):
statements.append(statement)
return statements
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="camt_bank_journal" model="account.journal">
<field name="name">Bank Journal - (test camt)</field>
<field name="code">TBNKCAMT</field>
<field name="type">bank</field>
<field name="sequence_id" ref="account.sequence_bank_journal"/>
<field name="default_debit_account_id" ref="account.bnk"/>
<field name="default_credit_account_id" ref="account.bnk"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="camt_company_bank" model="res.partner.bank">
<field name="owner_name">Your Company</field>
<field name="acc_number">NL77ABNA0574908765</field>
<field name="partner_id" ref="base.partner_root"></field>
<field name="company_id" ref="base.main_company"></field>
<field name="journal_id" ref="camt_bank_journal"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
</data>
</openerp>
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar extracto bancario"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importer Relevé Bancaire"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: Lithuanian (Lithuania) (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/lt_LT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: lt_LT\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importuoti banko išrašą"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
# Erwin van der Ploeg <erwin@bas-solutions.nl>, 2015
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-31 06:44+0000\n"
"Last-Translator: Erwin van der Ploeg <erwin@bas-solutions.nl>\n"
"Language-Team: Dutch (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importeer bankafschrift"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-09 09:23+0000\n"
"PO-Revision-Date: 2015-10-09 00:26+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar Extrato Bancário"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_camt
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-25 12:19+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: account_bank_statement_import_camt
#: model:ir.model,name:account_bank_statement_import_camt.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Uvoz bančnega izpiska"
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02">
<BkToCstmrStmt>
<GrpHdr>
<MsgId>TESTBANK/NL/1420561226673</MsgId>
<CreDtTm>2013-01-06T16:20:26.673Z</CreDtTm>
</GrpHdr>
<Stmt>
<Id>1234Test/1</Id>
<LglSeqNb>2</LglSeqNb>
<CreDtTm>2013-01-06T16:20:26.673Z</CreDtTm>
<FrToDt>
<FrDtTm>2013-01-05T00:00:00.000Z</FrDtTm>
<ToDtTm>2013-01-05T23:59:59.999Z</ToDtTm>
</FrToDt>
<Acct>
<Id>
<IBAN>NL77ABNA0574908765</IBAN>
</Id>
<Nm>Example company</Nm>
<Svcr>
<FinInstnId>
<BIC>ABNANL2A</BIC>
</FinInstnId>
</Svcr>
</Acct>
<Bal>
<Tp>
<CdOrPrtry>
<Cd>OPBD</Cd>
</CdOrPrtry>
</Tp>
<Amt Ccy="EUR">15568.27</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Dt>
<Dt>2013-01-05</Dt>
</Dt>
</Bal>
<Bal>
<Tp>
<CdOrPrtry>
<Cd>CLBD</Cd>
</CdOrPrtry>
</Tp>
<Amt Ccy="EUR">15121.12</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Dt>
<Dt>2013-01-05</Dt>
</Dt>
</Bal>
<Ntry>
<Amt Ccy="EUR">754.25</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
<Cd>PMNT</Cd>
<Fmly>
<Cd>RDDT</Cd>
<SubFmlyCd>ESDD</SubFmlyCd>
</Fmly>
</Domn>
<Prtry>
<Cd>EI</Cd>
</Prtry>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<InstrId>INNDNL2U20141231000142300002844</InstrId>
<EndToEndId>435005714488-ABNO33052620</EndToEndId>
<MndtId>1880000341866</MndtId>
</Refs>
<AmtDtls>
<TxAmt>
<Amt Ccy="EUR">754.25</Amt>
</TxAmt>
</AmtDtls>
<RltdPties>
<Cdtr>
<Nm>INSURANCE COMPANY TESTX</Nm>
<PstlAdr>
<StrtNm>TEST STREET 20</StrtNm>
<TwnNm>1234 AB TESTCITY</TwnNm>
<Ctry>NL</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>NL46ABNA0499998748</IBAN>
</Id>
</CdtrAcct>
</RltdPties>
<RltdAgts>
<CdtrAgt>
<FinInstnId>
<BIC>ABNANL2A</BIC>
</FinInstnId>
</CdtrAgt>
</RltdAgts>
<RmtInf>
<Ustrd>Insurance policy 857239PERIOD 01.01.2013 - 31.12.2013</Ustrd>
</RmtInf>
<AddtlTxInf>MKB Insurance 859239PERIOD 01.01.2013 - 31.12.2013</AddtlTxInf>
</TxDtls>
</NtryDtls>
</Ntry>
<Ntry>
<Amt Ccy="EUR">594.05</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<RvslInd>true</RvslInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
<Cd>PMNT</Cd>
<Fmly>
<Cd>IDDT</Cd>
<SubFmlyCd>UPDD</SubFmlyCd>
</Fmly>
</Domn>
<Prtry>
<Cd>EIST</Cd>
</Prtry>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<InstrId>TESTBANK/NL/20141229/01206408</InstrId>
<EndToEndId>TESTBANK/NL/20141229/01206408</EndToEndId>
<MndtId>NL22ZZZ524885430000-C0125.1</MndtId>
</Refs>
<AmtDtls>
<TxAmt>
<Amt Ccy="EUR">564.05</Amt>
</TxAmt>
</AmtDtls>
<RltdPties>
<Cdtr>
<Nm>Test Customer</Nm>
<PstlAdr>
<Ctry>NL</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>NL46ABNA0499998748</IBAN>
</Id>
</CdtrAcct>
</RltdPties>
<RltdAgts>
<CdtrAgt>
<FinInstnId>
<BIC>ABNANL2A</BIC>
</FinInstnId>
</CdtrAgt>
</RltdAgts>
<RmtInf>
<Ustrd>Direct Debit S14 0410</Ustrd>
</RmtInf>
<RtrInf>
<Rsn>
<Cd>AC06</Cd>
</Rsn>
</RtrInf>
<AddtlTxInf>Direct debit S14 0410 AC07 Rek.nummer blokkade TESTBANK/NL/20141229/01206408</AddtlTxInf>
</TxDtls>
</NtryDtls>
</Ntry>
<Ntry>
<Amt Ccy="EUR">1405.31</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Sts>BOOK</Sts>
<BookgDt>
<Dt>2013-01-05</Dt>
</BookgDt>
<ValDt>
<Dt>2013-01-05</Dt>
</ValDt>
<BkTxCd>
<Domn>
<Cd>PMNT</Cd>
<Fmly>
<Cd>RCDT</Cd>
<SubFmlyCd>ESCT</SubFmlyCd>
</Fmly>
</Domn>
<Prtry>
<Cd>ET</Cd>
</Prtry>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<InstrId>INNDNL2U20130105000217200000708</InstrId>
<EndToEndId>115</EndToEndId>
</Refs>
<AmtDtls>
<TxAmt>
<Amt Ccy="EUR">1405.31</Amt>
</TxAmt>
</AmtDtls>
<RltdPties>
<Dbtr>
<Nm>3rd party Media</Nm>
<PstlAdr>
<StrtNm>SOMESTREET 570-A</StrtNm>
<TwnNm>1276 ML HOUSCITY</TwnNm>
<Ctry>NL</Ctry>
</PstlAdr>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>NL69ABNA0522123643</IBAN>
</Id>
</DbtrAcct>
</RltdPties>
<RltdAgts>
<DbtrAgt>
<FinInstnId>
<BIC>ABNANL2A</BIC>
</FinInstnId>
</DbtrAgt>
</RltdAgts>
<AddtlTxInf>#RD PARTY MEDIA CUSNO 90782 4210773</AddtlTxInf>
</TxDtls>
</NtryDtls>
</Ntry>
</Stmt>
</BkToCstmrStmt>
</Document>
# -*- encoding: utf-8 -*-
"""Test import of bank statement for camt.053."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# All other contributions are (C) by their respective contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import test_import_bank_statement
# -*- coding: utf-8 -*-
"""Run test to import camt.053 import."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.addons.account_bank_statement_import.tests import (
TestStatementFile)
class TestImport(TestStatementFile):
"""Run test to import camt import."""
def test_statement_import(self):
"""Test correct creation of single statement."""
transactions = [
{
'remote_account': 'NL46ABNA0499998748',
'transferred_amount': -754.25,
'value_date': '2013-01-05',
'ref': '435005714488-ABNO33052620',
},
]
# statement name is account number + '-' + date of last 62F line:
self._test_statement_import(
'account_bank_statement_import_camt', 'test-camt053.xml',
'1234Test/1',
local_account='NL77ABNA0574908765',
start_balance=15568.27, end_balance=15121.12,
transactions=transactions
)
Import French CFONB Bank Statements
===================================
This module allows you to import the text-based French
CFONB files in Odoo as bank statements.
Installation
============
This module depends on the module *account_bank_statement_import* which
is available:
* for Odoo version 8: in the OCA project `bank-statement-import <https://github.com/OCA/bank-statement-import>`
* for Odoo master (future version 9): it is an official module.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/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/l10n-france/issues/new?body=module:%20account_bank_statement_import_fr_cfonb%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Alexis de Lattre <alexis.delattre@akretion.com>
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://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.
# -*- coding: utf-8 -*-
from . import account_bank_statement_import_fr_cfonb
# -*- coding: utf-8 -*-
##############################################################################
#
# account_bank_statement_import_fr_cfonb module for Odoo
# Copyright (C) 2014-2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Import French CFONB Bank Statements',
'version': '9.0.0.1.1',
'license': 'AGPL-3',
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com',
'summary': 'Import French CFONB files as Bank Statements in Odoo',
'depends': ['account_bank_statement_import'],
'data': [],
'installable': True,
}
# -*- coding: utf-8 -*-
##############################################################################
#
# account_bank_statement_import_fr_cfonb module for Odoo
# Copyright (C) 2014-2015 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from datetime import datetime
from openerp import models, fields, api, _
from openerp.exceptions import UserError
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
_inherit = 'account.bank.statement.import'
_excluded_accounts = []
def _parse_cfonb_amount(self, amount_str, nb_of_dec):
"""Taken from the cfonb lib"""
amount_str = amount_str[:-nb_of_dec] + '.' + amount_str[-nb_of_dec:]
# translate the last char and set the sign
credit_trans = {
'A': '1', 'B': '2', 'C': '3', 'D': '4', 'E': '5',
'F': '6', 'G': '7', 'H': '8', 'I': '9', '{': '0'}
debit_trans = {
'J': '1', 'K': '2', 'L': '3', 'M': '4', 'N': '5',
'O': '6', 'P': '7', 'Q': '8', 'R': '9', '}': '0'}
assert (
amount_str[-1] in debit_trans or amount_str[-1] in credit_trans),\
'Invalid amount in CFONB file'
if amount_str[-1] in debit_trans:
amount_num = float(
'-' + amount_str[:-1] + debit_trans[amount_str[-1]])
elif amount_str[-1] in credit_trans:
amount_num = float(amount_str[:-1] + credit_trans[amount_str[-1]])
return amount_num
@api.model
def _check_cfonb(self, data_file):
return data_file.strip().startswith('01')
@api.model
def _parse_file(self, data_file):
""" Import a file in French CFONB format"""
cfonb = self._check_cfonb(data_file)
if not cfonb:
return super(AccountBankStatementImport, self)._parse_file(
data_file)
transactions = []
if not data_file.splitlines():
raise UserError(
_('The file is empty.'))
i = 0
bank_code = guichet_code = account_number = currency_code = False
decimals = start_balance = False
start_balance = end_balance = start_date_str = end_date_str = False
vals_line = False
for line in data_file.splitlines():
i += 1
_logger.debug("Line %d: %s" % (i, line))
if not line:
continue
if len(line) != 120:
raise UserError(
_('Line %d is %d caracters long. All lines of a '
'CFONB bank statement file must be 120 caracters '
'long.')
% (i, len(line)))
line_bank_code = line[2:7]
line_guichet_code = line[11:16]
line_account_number = line[21:32]
line_currency_code = line[16:19]
rec_type = line[0:2]
decimals = int(line[19:20])
date_cfonb_str = line[34:40]
date_dt = False
date_str = False
if line_account_number in self._excluded_accounts:
continue
if date_cfonb_str != ' ':
date_dt = datetime.strptime(date_cfonb_str, '%d%m%y')
date_str = fields.Date.to_string(date_dt)
assert decimals == 2, 'We use 2 decimals in France!'
if i == 1:
bank_code = line_bank_code
guichet_code = line_guichet_code
currency_code = line_currency_code
account_number = line_account_number
if rec_type != '01':
raise UserError(
_("The 2 first letters of the first line are '%s'. "
"A CFONB file should start with '01'")
% rec_type)
start_balance = self._parse_cfonb_amount(
line[90:104], decimals)
start_date_str = date_str
if (
bank_code != line_bank_code or
guichet_code != line_guichet_code or
currency_code != line_currency_code or
account_number != line_account_number):
raise UserError(
_('Only single-account files and single-currency '
'files are supported for the moment. It is not '
'the case starting from line %d.') % i)
if rec_type in ('04', '01', '07') and vals_line:
# I save the previous line
# This trick is needed for the 05 lines
transactions.append(vals_line)
vals_line = False
if rec_type == '07':
end_date_str = date_str
end_balance = self._parse_cfonb_amount(line[90:104], decimals)
elif rec_type == '04':
bank_account_id = partner_id = False
amount = self._parse_cfonb_amount(line[90:104], decimals)
ref = line[81:88].strip() # This is not unique
name = line[48:79].strip()
vals_line = {
'date': date_str,
'name': name,
'ref': ref,
'unique_import_id':
'%s-%s-%.2f-%s' % (date_str, ref, amount, name),
'amount': amount,
'partner_id': partner_id,
'bank_account_id': bank_account_id,
}
elif rec_type == '05':
assert vals_line, 'vals_line should have a value !'
vals_line['name'] += ' %s' % line[48:79].strip()
vals_bank_statement = {
'name': _('Account %s %s > %s') % (
account_number, start_date_str, end_date_str),
'balance_start': start_balance,
'balance_end_real': end_balance,
'transactions': transactions,
}
return currency_code, account_number, [vals_bank_statement]
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_fr_cfonb
#
# Translators:
# Imre Kristoffer Eilertsen <imreeil42@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: l10n-france (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-30 21:33+0000\n"
"PO-Revision-Date: 2016-08-04 05:08+0000\n"
"Last-Translator: Imre Kristoffer Eilertsen <imreeil42@gmail.com>\n"
"Language-Team: Norwegian Bokmål (Norway) (http://www.transifex.com/oca/OCA-l10n-france-9-0/language/nb_NO/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nb_NO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_fr_cfonb
#: code:addons/account_bank_statement_import_fr_cfonb/account_bank_statement_import_fr_cfonb.py:155
#, python-format
msgid "Account %s %s > %s"
msgstr "Konto %s %s > %s"
#. module: account_bank_statement_import_fr_cfonb
#: model:ir.model,name:account_bank_statement_import_fr_cfonb.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importer bankutsagn"
#. module: account_bank_statement_import_fr_cfonb
#: code:addons/account_bank_statement_import_fr_cfonb/account_bank_statement_import_fr_cfonb.py:83
#, python-format
msgid ""
"Line %d is %d caracters long. All lines of a CFONB bank statement file must "
"be 120 caracters long."
msgstr "Linje %d er %d tegn langt. Alle linjer i en CFONB-bankutsagnsfil må være 120 tegn langt."
#. module: account_bank_statement_import_fr_cfonb
#: code:addons/account_bank_statement_import_fr_cfonb/account_bank_statement_import_fr_cfonb.py:123
#, python-format
msgid ""
"Only single-account files and single-currency files are supported for the "
"moment. It is not the case starting from line %d."
msgstr "Kun enkeltkontofiler og enkeltmyntenhetsfiler støttes for øyeblikket. Dette er ikke tilfellet fra og med linje %d og utover."
#. module: account_bank_statement_import_fr_cfonb
#: code:addons/account_bank_statement_import_fr_cfonb/account_bank_statement_import_fr_cfonb.py:110
#, python-format
msgid ""
"The 2 first letters of the first line are '%s'. A CFONB file should start "
"with '01'"
msgstr ""
#. module: account_bank_statement_import_fr_cfonb
#: code:addons/account_bank_statement_import_fr_cfonb/account_bank_statement_import_fr_cfonb.py:70
#, python-format
msgid "The file is empty."
msgstr "Filen er tom."
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Bank Statement MT940
====================
This module provides a generic parser for MT940 files. Given that MT940 is a
non-open non-standard of pure evil in the way that every bank cooks up its own
interpretation of it, this addon alone won't help you much. It is rather
intended to be used by other addons to implement the dialect specific to a
certain bank.
See bank_statement_parse_nl_ing_mt940 for an example on how to use it.
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
------------
* Stefan Rijnhart <srijnhart@therp.nl>
* 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.
This module should make it easy to migrate bank statement import
modules written for earlies versions of Odoo/OpenERP.
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'MT940 Bank Statements Import',
'version': '8.0.1.1.0',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Therp BV',
'website': 'https://github.com/OCA/bank-statement-import',
'category': 'Banking addons',
'depends': [
'account_bank_statement_import',
],
'installable': False
}
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Import MT940 IBAN ING Bank Statements
=====================================
This module allows you to import the MT940 IBAN files from the Dutch ING bank
in Odoo as bank statements.
The specifications are published at:
https://www.ing.nl/media/ING_ming_mt940s_24_juli_tcm162-46356.pdf
and were last updated august 2014.
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
------------
* Stefan Rijnhart <srijnhart@therp.nl>
* 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.
This module should make it easy to migrate bank statement import
modules written for earlies versions of Odoo/OpenERP.
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'MT940 IBAN ING Format Bank Statements Import',
'version': '8.0.0.3.0',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Therp BV',
'website': 'https://github.com/OCA/bank-statement-import',
'category': 'Banking addons',
'depends': [
'account_bank_statement_import_mt940_base'
],
'demo': [
'demo/demo_data.xml',
],
'installable': False
}
# -*- coding: utf-8 -*-
"""Parse a MT940 ING file."""
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from openerp import models
from .mt940 import MT940Parser as Parser
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
"""Add parsing of mt940 files to bank statement import."""
_inherit = 'account.bank.statement.import'
def _parse_file(self, cr, uid, data_file, context=None):
"""Parse a MT940 IBAN ING file."""
parser = Parser()
try:
_logger.debug("Try parsing with MT940 IBAN ING.")
return parser.parse(data_file)
except ValueError:
# Returning super will call next candidate:
_logger.debug("Statement file was not a MT940 IBAN ING file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="mt940_ing_bank_journal" model="account.journal">
<field name="name">Bank Journal - (test mt940 ING)</field>
<field name="code">TBNKMT940ING</field>
<field name="type">bank</field>
<field name="sequence_id" ref="account.sequence_bank_journal"/>
<field name="default_debit_account_id" ref="account.bnk"/>
<field name="default_credit_account_id" ref="account.bnk"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="mt940_ing_company_bank" model="res.partner.bank">
<field name="owner_name">Your Company</field>
<field name="acc_number">NL77INGB0574908765</field>
<field name="partner_id" ref="base.partner_root"></field>
<field name="company_id" ref="base.main_company"></field>
<field name="journal_id" ref="mt940_ing_bank_journal"></field>
<field name="state">bank</field>
<field name="bank" ref="base.res_bank_1"/>
</record>
</data>
</openerp>
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar extracto bancario"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importer Relevé Bancaire"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: Lithuanian (Lithuania) (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/lt_LT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: lt_LT\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importuoti banko išrašą"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-31 06:44+0000\n"
"Last-Translator: Erwin van der Ploeg <erwin@bas-solutions.nl>\n"
"Language-Team: Dutch (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/nl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Geïmporteerd bankafschrift"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-09 09:23+0000\n"
"PO-Revision-Date: 2015-10-09 00:26+0000\n"
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar Extrato Bancário"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_ing
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-25 12:19+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
#. module: account_bank_statement_import_mt940_nl_ing
#: model:ir.model,name:account_bank_statement_import_mt940_nl_ing.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Uvoz bančnega izpiska"
# -*- coding: utf-8 -*-
"""Implement BankStatementParser for MT940 IBAN ING files."""
##############################################################################
#
# Copyright (C) 2014-2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import re
from openerp.addons.account_bank_statement_import_mt940_base.mt940 import (
MT940, str2amount, get_subfields, handle_common_subfields)
class MT940Parser(MT940):
"""Parser for ing MT940 bank statement import files."""
tag_61_regex = re.compile(
r'^(?P<date>\d{6})(?P<line_date>\d{0,4})'
r'(?P<sign>[CD])(?P<amount>\d+,\d{2})N(?P<type>.{3})'
r'(?P<reference>\w{1,50})'
)
def __init__(self):
"""Initialize parser - override at least header_regex."""
super(MT940Parser, self).__init__()
self.mt940_type = 'ING'
def handle_tag_61(self, data):
"""get transaction values"""
super(MT940Parser, self).handle_tag_61(data)
re_61 = self.tag_61_regex.match(data)
if not re_61:
raise ValueError("Cannot parse %s" % data)
parsed_data = re_61.groupdict()
self.current_transaction.transferred_amount = (
str2amount(parsed_data['sign'], parsed_data['amount']))
self.current_transaction.eref = parsed_data['reference']
def handle_tag_86(self, data):
"""Parse 86 tag containing reference data."""
if not self.current_transaction:
return
codewords = ['RTRN', 'BENM', 'ORDP', 'CSID', 'BUSP', 'MARF', 'EREF',
'PREF', 'REMI', 'ID', 'PURP', 'ULTB', 'ULTD',
'CREF', 'IREF', 'CNTP', 'ULTC', 'EXCH', 'CHGS']
subfields = get_subfields(data, codewords)
transaction = self.current_transaction
# If we have no subfields, set message to whole of data passed:
if not subfields:
transaction.message = data
else:
handle_common_subfields(transaction, subfields)
# Prevent handling tag 86 later for non transaction details:
self.current_transaction = None
0000 01INGBNL2AXXXX00001
0000 01INGBNL2AXXXX00001
940 00
:20:P140120000000001
:25:NL77INGB0574908765EUR
:28C:0000
0
:60F:C140119EUR662,23
:61:1401200220C1,56NTRFEREF//00000000001
005
/TRCD/00100/
:86:/EREF/EV12341REP1231456T1234//CNTP/NL32INGB0000012345/INGBNL2
A/ING BANK NV INZAKE WEB///REMI/USTD//EV10001REP1000000T1000/
:61:1401200220D1,57NTRFPREF//00000000001006
/TRCD/00200/
:86:/PREF/M000000003333333//REMI/USTD//TOTAAL 1 VZ/
:61:1401200220C1,57NRTIEREF//00000000001007
/TRCD/00190/
:86:/RTRN/MS03//EREF/20120123456789//CNTP/NL32INGB0000012345/INGB
NL2A/J.Janssen///REMI/USTD//Factuurnr 123456 Klantnr 00123/
:61:1401200220D1,14NDDTEREF//00000000001009
/TRCD/010
16
/
:86:/EREF/EV123R
EP123412T1234//MARF/MND
-
EV01//CSID/NL32ZZZ9999999
91234//CNTP/NL32INGB0000012345/INGBNL2A/ING Bank N.V. inzake WeB/
//REMI/USTD//EV123REP123412T1234/
:61:1401200220C1,45NDDTPREF//00000000001008
/TRCD/01000/
:86:/PREF/M000000001111111/
/CSID/
NL32ZZZ999999991234
/
/REMI/USTD//
TOTAAL 1 POSTEN/
:61:1401200220D12,75NRTIEREF//00000000001010
/TRCD/01315/
:86:/RTRN/MS03//EREF/20120501P0123478//MARF/MND
-
120123//CSID/NL32
ZZZ999999991234//CNTP/NL32INGB0000012345/INGBNL2A/J.Janssen///REM
I/USTD//CO
NTRIBUTIE FEB 2014/
:61:1401200220C32,00NTRF9001123412341234//00000000001011
/TRCD/00108/
:86:/EREF/15814016000676480//CNTP/NL32INGB0000012345/INGBNL2A/J.J
anssen///REMI/STRD/CUR/9001123412341234/
:61:1401200220D119,00NTRF1070123412341234//00000000001012
/
TRCD/00108/
:86:/EREF/15614016000384600//CNTP/NL32INGB0000012345/INGBNL2A/ING
BANK NV///REMI/STRD/CUR/1070123412341234/
:62F:C140120EUR564,35
:64:C140120EUR564,35
:65:C140121EUR564,35
:65:C140124EUR564,35
:86:/SUM/4/4/134,46/36,58/
-XXX
{1:F01INGBNL2ABXXX0000000000}
{2:I940INGBNL2AXXXN}
{4:
:20:P140220000000001
:25:NL77INGB0574908765EUR
:28C:0000
0
:60F:C140219EUR662,23
:61:1402200220C1,56NTRFEREF//00000000001
005
/TRCD/00100/
:86:/EREF/EV12341REP1231456T1234//CNTP/NL32INGB0000012345/INGBNL2
A/ING BANK NV INZAKE WEB///REMI/USTD//EV10001REP1000000T1000/
:61:1402200220D1,57NTRFPREF//00000000001006
/TRCD/00200/
:86:/PREF/M000000003333333//REMI/USTD//TOTAAL 1 VZ/
:61:1402200220C1,57NRTIEREF//00000000001007
/TRCD/00190/
:86:/RTRN/MS03//EREF/20120123456789//CNTP/NL32INGB0000012345/INGB
NL2A/J.Janssen///REMI/USTD//Factuurnr 123456 Klantnr 00123/
:61:1402200220D1,14NDDTEREF//00000000001009
/TRCD/010
16
/
:86:/EREF/EV123R
EP123412T1234//MARF/MND
-
EV01//CSID/NL32ZZZ9999999
91234//CNTP/NL32INGB0000012345/INGBNL2A/ING Bank N.V. inzake WeB/
//REMI/USTD//EV123REP123412T1234/
:61:1402200220C1,45NDDTPREF//00000000001008
/TRCD/01000/
:86:/PREF/M000000001111111/
/CSID/
NL32ZZZ999999991234
/
/REMI/USTD//
TOTAAL 1 POSTEN/
:61:1402200220D12,75NRTIEREF//00000000001010
/TRCD/01315/
:86:/RTRN/MS03//EREF/20120501P0123478//MARF/MND
-
120123//CSID/NL32
ZZZ999999991234//CNTP/NL32INGB0000012345/INGBNL2A/J.Janssen///REM
I/USTD//CO
NTRIBUTIE FEB 2014/
:61:1402200220C32,00NTRF9001123412341234//00000000001011
/TRCD/00108/
:86:/EREF/15814016000676480//CNTP/NL32INGB0000012345/INGBNL2A/J.J
anssen///REMI/STRD/CUR/9001123412341234/
:61:1402200220D119,00NTRF1070123412341234//00000000001012
/
TRCD/00108/
:86:/EREF/15614016000384600//CNTP/NL32INGB0000012345/INGBNL2A/ING
BANK NV///REMI/STRD/CUR/1070123412341234/
:62F:C140220EUR564,35
:64:C140220EUR564,35
:65:C140221EUR564,35
:65:C140224EUR564,35
:86:/SUM/4/4/134,46/36,58/
-
}
# -*- encoding: utf-8 -*-
"""Test import of bank statement for MT940 ING."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# All other contributions are (C) by their respective contributors
#
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import test_import_bank_statement
# -*- coding: utf-8 -*-
"""Run test to import MT940 IBAN ING import."""
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>.
#
# All other contributions are (C) by their respective contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.addons.account_bank_statement_import.tests import (
TestStatementFile)
class TestImport(TestStatementFile):
"""Run test to import MT940 ING import."""
def test_old_statement_import(self):
"""Test correct creation of single statement from old format."""
self._test_statement_import(
'account_bank_statement_import_mt940_nl_ing', 'test-ing-old.940',
'NL77INGB0574908765-2014-01-20',
start_balance=662.23, end_balance=564.35
)
def test_statement_import(self):
"""Test correct creation of single statement."""
transactions = [
{
'remote_account': 'NL32INGB0000012345',
'transferred_amount': 1.56,
'value_date': '2014-02-20',
'ref': 'EV12341REP1231456T1234',
},
]
self._test_statement_import(
'account_bank_statement_import_mt940_nl_ing', 'test-ing.940',
'NL77INGB0574908765-2014-02-20',
start_balance=662.23, end_balance=564.35,
transactions=transactions
)
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
Bank Statement NL Rabobank MT940
================================
This addon imports the structured MT940 format as offered by
the dutch Rabobank.
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
------------
* 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.
This module should make it easy to migrate bank statement import
modules written for earlies versions of Odoo/OpenERP.
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import account_bank_statement_import
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'MT940 import for dutch Rabobank',
'version': '8.0.1.1.0',
'author': 'Odoo Community Association (OCA), Therp BV',
'website': 'https://github.com/OCA/bank-statement-import',
'category': 'Banking addons',
'depends': [
'account_bank_statement_import_mt940_base'
],
'auto_install': False,
'installable': False,
'application': False,
}
# -*- coding: utf-8 -*-
"""Parse a MT940 RABO file."""
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from openerp import models
from .mt940 import MT940Parser as Parser
_logger = logging.getLogger(__name__)
class AccountBankStatementImport(models.TransientModel):
"""Add parsing of RABO mt940 files to bank statement import."""
_inherit = 'account.bank.statement.import'
def _parse_file(self, cr, uid, data_file, context=None):
"""Parse a MT940 RABO file."""
parser = Parser()
try:
_logger.debug("Try parsing with MT940 RABO.")
statements = parser.parse(data_file)
return statements
except ValueError:
# Returning super will call next candidate:
_logger.debug("Statement file was not a MT940 RABO file.",
exc_info=True)
return super(AccountBankStatementImport, self)._parse_file(
cr, uid, data_file, context=context)
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_rabo
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_bank_statement_import_mt940_nl_rabo
#: model:ir.model,name:account_bank_statement_import_mt940_nl_rabo.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importar extracto bancario"
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_bank_statement_import_mt940_nl_rabo
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: bank-statement-import (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-07-24 21:51+0000\n"
"PO-Revision-Date: 2015-07-24 07:41+0000\n"
"Last-Translator: <>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-statement-import-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_bank_statement_import_mt940_nl_rabo
#: model:ir.model,name:account_bank_statement_import_mt940_nl_rabo.model_account_bank_statement_import
msgid "Import Bank Statement"
msgstr "Importer Relevé Bancaire"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment