From a1a64472970ac749c2568f32d6c4e73be7c38b2c Mon Sep 17 00:00:00 2001 From: Matthieu Dietrich Date: Wed, 27 Apr 2016 17:23:11 +0200 Subject: [PATCH] Fix tests + behavior --- account_statement_base_completion/__init__.py | 23 -- .../__openerp__.py | 87 ------- account_statement_base_completion/i18n/ab.po | 216 ---------------- .../account_statement_base_completion.pot | 199 --------------- account_statement_base_completion/i18n/es.po | 235 ------------------ account_statement_base_completion/i18n/fr.po | 223 ----------------- .../statement_view.xml | 99 -------- .../test/completion_test.yml | 102 -------- .../test/invoice.yml | 32 --- .../tests/__init__.py | 27 -- account_statement_base_import/README.rst | 102 ++++++++ account_statement_base_import/__init__.py | 22 +- account_statement_base_import/__openerp__.py | 103 +++----- .../data/completion_rule_data.xml | 8 +- .../data/statement.xls | Bin 6656 -> 7168 bytes .../models/account_journal.py | 26 +- .../models/account_move.py | 99 +++++--- .../models/partner.py | 23 +- .../test/completion_test.yml | 125 ++++++++++ .../test/invoice.yml | 42 ++++ .../test/partner.yml | 2 +- .../test/refund.yml | 17 +- .../test/supplier_invoice.yml | 15 +- .../tests/test_base_completion.py | 81 +++--- .../tests/test_base_import.py | 84 +++---- .../views/journal_view.xml | 10 +- .../wizard/import_statement.py | 12 +- account_statement_commission/__init__.py | 22 -- account_statement_commission/__openerp__.py | 48 ---- account_statement_commission/commission.py | 72 ------ .../i18n/account_statement_commission.pot | 53 ---- account_statement_commission/i18n/es.po | 54 ---- .../import_statement_view.xml | 17 -- .../statement_view.xml | 20 -- 34 files changed, 488 insertions(+), 1812 deletions(-) delete mode 100644 account_statement_base_completion/__init__.py delete mode 100644 account_statement_base_completion/__openerp__.py delete mode 100644 account_statement_base_completion/i18n/ab.po delete mode 100644 account_statement_base_completion/i18n/account_statement_base_completion.pot delete mode 100644 account_statement_base_completion/i18n/es.po delete mode 100644 account_statement_base_completion/i18n/fr.po delete mode 100644 account_statement_base_completion/statement_view.xml delete mode 100644 account_statement_base_completion/test/completion_test.yml delete mode 100644 account_statement_base_completion/test/invoice.yml delete mode 100644 account_statement_base_completion/tests/__init__.py create mode 100644 account_statement_base_import/README.rst create mode 100644 account_statement_base_import/test/completion_test.yml create mode 100644 account_statement_base_import/test/invoice.yml rename {account_statement_base_completion => account_statement_base_import}/test/partner.yml (62%) rename {account_statement_base_completion => account_statement_base_import}/test/refund.yml (71%) rename {account_statement_base_completion => account_statement_base_import}/test/supplier_invoice.yml (66%) delete mode 100644 account_statement_commission/__init__.py delete mode 100644 account_statement_commission/__openerp__.py delete mode 100644 account_statement_commission/commission.py delete mode 100644 account_statement_commission/i18n/account_statement_commission.pot delete mode 100644 account_statement_commission/i18n/es.po delete mode 100644 account_statement_commission/import_statement_view.xml delete mode 100644 account_statement_commission/statement_view.xml diff --git a/account_statement_base_completion/__init__.py b/account_statement_base_completion/__init__.py deleted file mode 100644 index a219be6a..00000000 --- a/account_statement_base_completion/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -from . import partner -from . import statement diff --git a/account_statement_base_completion/__openerp__.py b/account_statement_base_completion/__openerp__.py deleted file mode 100644 index edfcbe92..00000000 --- a/account_statement_base_completion/__openerp__.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA -# -# 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 . -# -############################################################################## - -{ - 'name': "Bank statement base completion", - 'version': '1.0.3', - 'author': "Camptocamp,Odoo Community Association (OCA)", - 'maintainer': 'Camptocamp', - 'category': 'Finance', - 'complexity': 'normal', - 'depends': ['account_statement_ext', - 'account_report_company'], - 'description': """ - The goal of this module is to improve the basic bank statement, help dealing - with huge volume of reconciliation by providing basic rules to identify the - partner of a bank statement line. - Each bank statement profile can have its own rules to be applied according to - a sequence order. - - Some basic rules are provided in this module: - - 1) Match from statement line label (based on partner field 'Bank Statement - Label') - 2) Match from statement line label (based on partner name) - 3) Match from statement line reference (based on Invoice number) - - You can easily override this module and add your own rules in your own one. - The basic rules only fill in the partner, but you can use them to fill in - any value of the line (in the future, we will add a rule to automatically - match and reconcile the line). - - It adds as well a label on the bank statement line (on which the pre-define - rules can match) and a char field on the partner called 'Bank Statement - Label'. Using the pre-define rules, you will be able to match various - labels for a partner. - - The reference of the line is always used by the reconciliation process. We're - supposed to copy there (or write manually) the matching string. This can be: - the order Number or an invoice number, or anything that will be found in the - invoice accounting entry part to make the match. - - You can use it with our account_advanced_reconcile module to automatize the - reconciliation process. - - - TODO: The rules that look for invoices to find out the partner should take - back the payable / receivable account from there directly instead of - retrieving it from partner properties! - """, - 'website': 'http://www.camptocamp.com', - 'data': [ - 'statement_view.xml', - 'partner_view.xml', - 'data.xml', - 'security/ir.model.access.csv', - ], - 'demo': [], - 'test': [ - 'test/partner.yml', - 'test/invoice.yml', - 'test/supplier_invoice.yml', - 'test/refund.yml', - 'test/completion_test.yml' - ], - 'installable': False, - 'images': [], - 'auto_install': False, - 'license': 'AGPL-3', -} diff --git a/account_statement_base_completion/i18n/ab.po b/account_statement_base_completion/i18n/ab.po deleted file mode 100644 index b36cb564..00000000 --- a/account_statement_base_completion/i18n/ab.po +++ /dev/null @@ -1,216 +0,0 @@ -# Abkhazian translation for banking-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the banking-addons package. -# FIRST AUTHOR , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: banking-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2014-01-21 11:57+0000\n" -"PO-Revision-Date: 2014-04-02 23:04+0000\n" -"Last-Translator: FULL NAME \n" -"Language-Team: Abkhazian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-05-22 06:49+0000\n" -"X-Generator: Launchpad (build 17017)\n" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -msgid "Related Profiles" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,label:0 -msgid "" -"Generic field to store a label given from the bank/office on which we can " -"base the default/standard providen rule." -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:169 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on %s invoices" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement,completion_logs:0 -msgid "Completion Log" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,label:0 -msgid "Label" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement -msgid "Bank Statement" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,function_to_call:0 -msgid "Method" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:326 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner by name" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:504 -#, python-format -msgid "Statement ID %s auto-completed for %s lines completed" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:500 -#, python-format -msgid "" -"%s Bank Statement ID %s has %s lines completed by %s \n" -"%s\n" -"%s\n" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line -msgid "Bank Statement Line" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,additionnal_bank_fields:0 -msgid "Additionnal infos from bank" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.statement.profile:0 -msgid "Auto-Completion Rules" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Importation related infos" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:159 -#: code:addons/account_statement_base_completion/statement.py:179 -#, python-format -msgid "Invalid invoice type for completion: %" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,name:0 -msgid "Name" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile -msgid "Statement Profile" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Auto Completion" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree -#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu -msgid "Statement Completion Rule" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule -msgid "account.statement.completion.rule" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,additionnal_bank_fields:0 -msgid "" -"Used by completion and import system. Adds every field that is present in " -"your bank/office statement file" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,profile_ids:0 -#: field:account.statement.profile,rule_ids:0 -msgid "Related statement profiles" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:158 -#: code:addons/account_statement_base_completion/statement.py:178 -#, python-format -msgid "System error" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,already_completed:0 -msgid "Auto-Completed" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:448 -#: code:addons/account_statement_base_completion/statement.py:466 -#, python-format -msgid "ORM bypass error" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,sequence:0 -msgid "Sequence" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:280 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner label: %s" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.statement.completion.rule,sequence:0 -msgid "Lower means parsed first." -msgstr "" - -#. module: account_statement_base_completion -#: field:res.partner,bank_statement_label:0 -msgid "Bank Statement Label" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,already_completed:0 -msgid "" -"When this checkbox is ticked, the auto-completion process/button will ignore " -"this line." -msgstr "" - -#. module: account_statement_base_completion -#: help:res.partner,bank_statement_label:0 -msgid "" -"Enter the various label found on your bank statement separated by a ; If " -" one of this label is include in the bank statement line, the " -"partner will be automatically filled (as long as you use " -"this method/rules in your statement profile)." -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_res_partner -msgid "Partner" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Completion Logs" -msgstr "" diff --git a/account_statement_base_completion/i18n/account_statement_base_completion.pot b/account_statement_base_completion/i18n/account_statement_base_completion.pot deleted file mode 100644 index 50f00fa5..00000000 --- a/account_statement_base_completion/i18n/account_statement_base_completion.pot +++ /dev/null @@ -1,199 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_statement_base_completion -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-21 11:57+0000\n" -"PO-Revision-Date: 2014-01-21 11:57+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_statement_base_completion -#: view:account.statement.completion.rule:0 -msgid "Related Profiles" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,label:0 -msgid "Generic field to store a label given from the bank/office on which we can base the default/standard providen rule." -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:169 -#, python-format -msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on %s invoices" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement,completion_logs:0 -msgid "Completion Log" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,label:0 -msgid "Label" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement -msgid "Bank Statement" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,function_to_call:0 -msgid "Method" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:326 -#, python-format -msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on partner by name" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:504 -#, python-format -msgid "Statement ID %s auto-completed for %s lines completed" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:500 -#, python-format -msgid "%s Bank Statement ID %s has %s lines completed by %s \n" -"%s\n" -"%s\n" -"" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line -msgid "Bank Statement Line" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,additionnal_bank_fields:0 -msgid "Additionnal infos from bank" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.statement.profile:0 -msgid "Auto-Completion Rules" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Importation related infos" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:159 -#: code:addons/account_statement_base_completion/statement.py:179 -#, python-format -msgid "Invalid invoice type for completion: %" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,name:0 -msgid "Name" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile -msgid "Statement Profile" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Auto Completion" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree -#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu -msgid "Statement Completion Rule" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule -msgid "account.statement.completion.rule" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,additionnal_bank_fields:0 -msgid "Used by completion and import system. Adds every field that is present in your bank/office statement file" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,profile_ids:0 -#: field:account.statement.profile,rule_ids:0 -msgid "Related statement profiles" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:158 -#: code:addons/account_statement_base_completion/statement.py:178 -#, python-format -msgid "System error" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,already_completed:0 -msgid "Auto-Completed" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:448 -#: code:addons/account_statement_base_completion/statement.py:466 -#, python-format -msgid "ORM bypass error" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,sequence:0 -msgid "Sequence" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:280 -#, python-format -msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner while looking on partner label: %s" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.statement.completion.rule,sequence:0 -msgid "Lower means parsed first." -msgstr "" - -#. module: account_statement_base_completion -#: field:res.partner,bank_statement_label:0 -msgid "Bank Statement Label" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,already_completed:0 -msgid "When this checkbox is ticked, the auto-completion process/button will ignore this line." -msgstr "" - -#. module: account_statement_base_completion -#: help:res.partner,bank_statement_label:0 -msgid "Enter the various label found on your bank statement separated by a ; If one of this label is include in the bank statement line, the partner will be automatically filled (as long as you use this method/rules in your statement profile)." -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_res_partner -msgid "Partner" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Completion Logs" -msgstr "" - diff --git a/account_statement_base_completion/i18n/es.po b/account_statement_base_completion/i18n/es.po deleted file mode 100644 index 5305a248..00000000 --- a/account_statement_base_completion/i18n/es.po +++ /dev/null @@ -1,235 +0,0 @@ -# Spanish translation for banking-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the banking-addons package. -# FIRST AUTHOR , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: banking-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2014-01-21 11:57+0000\n" -"PO-Revision-Date: 2014-06-05 22:02+0000\n" -"Last-Translator: Pedro Manuel Baeza \n" -"Language-Team: Spanish \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-06 06:36+0000\n" -"X-Generator: Launchpad (build 17031)\n" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -msgid "Related Profiles" -msgstr "Perfiles relacionados" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,label:0 -msgid "" -"Generic field to store a label given from the bank/office on which we can " -"base the default/standard providen rule." -msgstr "" -"Campo genérico para almacenar una etiqueta dad por el banco/entidad en la " -"que podemos basar la regla provista por defecto." - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:169 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on %s invoices" -msgstr "" -"La línea llamada \"%s\" (Ref: %s) fue casada con más de una empresa al " -"buscar en las facturas %s" - -#. module: account_statement_base_completion -#: field:account.bank.statement,completion_logs:0 -msgid "Completion Log" -msgstr "Registro de completado" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,label:0 -msgid "Label" -msgstr "Etiqueta" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement -msgid "Bank Statement" -msgstr "Extracto bancario" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,function_to_call:0 -msgid "Method" -msgstr "Método" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:326 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner by name" -msgstr "" -"La línea llamada \"%s\" (Ref: %s) fue casada con más de una empresa al " -"buscar por nombre de empresa" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:504 -#, python-format -msgid "Statement ID %s auto-completed for %s lines completed" -msgstr "Se han auto-completado para el extracto con ID %s %s líneas" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:500 -#, python-format -msgid "" -"%s Bank Statement ID %s has %s lines completed by %s \n" -"%s\n" -"%s\n" -msgstr "" -"%s El extracto bancario con ID %s tiene %s líneas completadas por %s \n" -"%s\n" -"%s\n" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line -msgid "Bank Statement Line" -msgstr "Línea del extracto bancario" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,additionnal_bank_fields:0 -msgid "Additionnal infos from bank" -msgstr "Información adicional del banco" - -#. module: account_statement_base_completion -#: view:account.statement.profile:0 -msgid "Auto-Completion Rules" -msgstr "Reglas de auto-completado" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Importation related infos" -msgstr "Información relacionada con la importación" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:159 -#: code:addons/account_statement_base_completion/statement.py:179 -#, python-format -msgid "Invalid invoice type for completion: %" -msgstr "Tipo de factura no válida para completado: %s" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,name:0 -msgid "Name" -msgstr "Nombre" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile -msgid "Statement Profile" -msgstr "Perfil de extracto" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Auto Completion" -msgstr "Auto completado" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree -#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu -msgid "Statement Completion Rule" -msgstr "Regla de completado del extracto" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule -msgid "account.statement.completion.rule" -msgstr "account.statement.completion.rule" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,additionnal_bank_fields:0 -msgid "" -"Used by completion and import system. Adds every field that is present in " -"your bank/office statement file" -msgstr "" -"Usado por el sistema de importación y completado. Añade cada campo que está " -"presente en su archivo de extracto del banco/entidad" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,profile_ids:0 -#: field:account.statement.profile,rule_ids:0 -msgid "Related statement profiles" -msgstr "Perfiles de extractos relacionados" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:158 -#: code:addons/account_statement_base_completion/statement.py:178 -#, python-format -msgid "System error" -msgstr "Error de sistema" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,already_completed:0 -msgid "Auto-Completed" -msgstr "Auto-completado" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:448 -#: code:addons/account_statement_base_completion/statement.py:466 -#, python-format -msgid "ORM bypass error" -msgstr "Error al saltar el ORM" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,sequence:0 -msgid "Sequence" -msgstr "Secuencia" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:280 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner label: %s" -msgstr "" -"La línea llamada \"%s\" (Ref: %s) fue casada con más de una empresa al " -"buscar por la etiqueta de empresa: %s" - -#. module: account_statement_base_completion -#: help:account.statement.completion.rule,sequence:0 -msgid "Lower means parsed first." -msgstr "Más bajo significa reconocido primero." - -#. module: account_statement_base_completion -#: field:res.partner,bank_statement_label:0 -msgid "Bank Statement Label" -msgstr "Etiqueta del extracto bancario" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,already_completed:0 -msgid "" -"When this checkbox is ticked, the auto-completion process/button will ignore " -"this line." -msgstr "" -"Cuando la casilla está marcada, el proceso de auto-completado/botón será " -"ignorado para esta línea." - -#. module: account_statement_base_completion -#: help:res.partner,bank_statement_label:0 -msgid "" -"Enter the various label found on your bank statement separated by a ; If " -" one of this label is include in the bank statement line, the " -"partner will be automatically filled (as long as you use " -"this method/rules in your statement profile)." -msgstr "" -"Introduzca los diversos tipos de etiqueta encontrados en el extracto " -"bancario, separados por un ;. Si una de estas etiquetas está incluida en la " -"línea del extracto bancario, la empresa será rellenada automáticamente " -"(mientras use este método/reglas en el perfil de extracto)." - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_res_partner -msgid "Partner" -msgstr "Empresa" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Completion Logs" -msgstr "Registro de completado" diff --git a/account_statement_base_completion/i18n/fr.po b/account_statement_base_completion/i18n/fr.po deleted file mode 100644 index f5443fa3..00000000 --- a/account_statement_base_completion/i18n/fr.po +++ /dev/null @@ -1,223 +0,0 @@ -# French translation for banking-addons -# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 -# This file is distributed under the same license as the banking-addons package. -# FIRST AUTHOR , 2014. -# -msgid "" -msgstr "" -"Project-Id-Version: banking-addons\n" -"Report-Msgid-Bugs-To: FULL NAME \n" -"POT-Creation-Date: 2014-01-21 11:57+0000\n" -"PO-Revision-Date: 2014-06-19 13:54+0000\n" -"Last-Translator: Joël Grand-Guillaume @ camptocamp " -"\n" -"Language-Team: French \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-06-20 06:09+0000\n" -"X-Generator: Launchpad (build 17058)\n" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -msgid "Related Profiles" -msgstr "Profils liés" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,label:0 -msgid "" -"Generic field to store a label given from the bank/office on which we can " -"base the default/standard providen rule." -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:169 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on %s invoices" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.bank.statement,completion_logs:0 -msgid "Completion Log" -msgstr "Journal des complétions" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,label:0 -msgid "Label" -msgstr "Libellé" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement -msgid "Bank Statement" -msgstr "Relevé bancaire" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,function_to_call:0 -msgid "Method" -msgstr "Méthode" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:326 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner by name" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:504 -#, python-format -msgid "Statement ID %s auto-completed for %s lines completed" -msgstr "" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:500 -#, python-format -msgid "" -"%s Bank Statement ID %s has %s lines completed by %s \n" -"%s\n" -"%s\n" -msgstr "" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line -msgid "Bank Statement Line" -msgstr "Ligne de relevé bancaire" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,additionnal_bank_fields:0 -msgid "Additionnal infos from bank" -msgstr "Informations additionnelles de la banque" - -#. module: account_statement_base_completion -#: view:account.statement.profile:0 -msgid "Auto-Completion Rules" -msgstr "Règles d'auto-complétion" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Importation related infos" -msgstr "Importation des informations liées" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:159 -#: code:addons/account_statement_base_completion/statement.py:179 -#, python-format -msgid "Invalid invoice type for completion: %" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,name:0 -msgid "Name" -msgstr "Nom" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_profile -msgid "Statement Profile" -msgstr "" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Auto Completion" -msgstr "Auto-complétion" - -#. module: account_statement_base_completion -#: view:account.statement.completion.rule:0 -#: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree -#: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu -msgid "Statement Completion Rule" -msgstr "Règle d'auto-complétion du relevé" - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule -msgid "account.statement.completion.rule" -msgstr "account.statement.completion.rule" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,additionnal_bank_fields:0 -msgid "" -"Used by completion and import system. Adds every field that is present in " -"your bank/office statement file" -msgstr "" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,profile_ids:0 -#: field:account.statement.profile,rule_ids:0 -msgid "Related statement profiles" -msgstr "Profils liés" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:158 -#: code:addons/account_statement_base_completion/statement.py:178 -#, python-format -msgid "System error" -msgstr "Erreur système" - -#. module: account_statement_base_completion -#: field:account.bank.statement.line,already_completed:0 -msgid "Auto-Completed" -msgstr "Auto-Complété" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:448 -#: code:addons/account_statement_base_completion/statement.py:466 -#, python-format -msgid "ORM bypass error" -msgstr "Erreur de bypass de l'ORM" - -#. module: account_statement_base_completion -#: field:account.statement.completion.rule,sequence:0 -msgid "Sequence" -msgstr "Séquence" - -#. module: account_statement_base_completion -#: code:addons/account_statement_base_completion/statement.py:280 -#, python-format -msgid "" -"Line named \"%s\" (Ref:%s) was matched by more than one partner while " -"looking on partner label: %s" -msgstr "" - -#. module: account_statement_base_completion -#: help:account.statement.completion.rule,sequence:0 -msgid "Lower means parsed first." -msgstr "Plus petite séquence analysée en premier." - -#. module: account_statement_base_completion -#: field:res.partner,bank_statement_label:0 -msgid "Bank Statement Label" -msgstr "Description de relevé bancaire" - -#. module: account_statement_base_completion -#: help:account.bank.statement.line,already_completed:0 -msgid "" -"When this checkbox is ticked, the auto-completion process/button will ignore " -"this line." -msgstr "" -"Les lignes cochées seront ignorées lorsque vous cliquez sur le bouton auto-" -"complétion" - -#. module: account_statement_base_completion -#: help:res.partner,bank_statement_label:0 -msgid "" -"Enter the various label found on your bank statement separated by a ; If " -" one of this label is include in the bank statement line, the " -"partner will be automatically filled (as long as you use " -"this method/rules in your statement profile)." -msgstr "" -"Entrez les différentes descriptions/informations sur votre relevé bancaire " -"séparées par un ';' Si l'une d'entre elles figure dans la ligne du " -"relevé, le partenaire correspondant sera automatiquement retrouvé " -"(à condition d'utiliser un règle de lettrage dans le profil)." - -#. module: account_statement_base_completion -#: model:ir.model,name:account_statement_base_completion.model_res_partner -msgid "Partner" -msgstr "Partenaire" - -#. module: account_statement_base_completion -#: view:account.bank.statement:0 -msgid "Completion Logs" -msgstr "Journaux d'auto-complétion" diff --git a/account_statement_base_completion/statement_view.xml b/account_statement_base_completion/statement_view.xml deleted file mode 100644 index f5d07bd5..00000000 --- a/account_statement_base_completion/statement_view.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - account_bank_statement_import_base.bank_statement.view_form - account.bank.statement - - - - - - - - - - - - - - - - - - - - - - - - - account_bank_statement_import_base.bank_statement.auto_cmpl - account.bank.statement - - - - - - - - - - - - account.statement.profile.view - account.statement.profile - - - - - - - - - - - - account.statement.completion.rule.view - account.statement.completion.rule - -
- - - - - - - -
- - - account.statement.completion.rule.view - account.statement.completion.rule - - - - - - - - - - - Statement Completion Rule - account.statement.completion.rule - form - tree,form - - - - -
-
diff --git a/account_statement_base_completion/test/completion_test.yml b/account_statement_base_completion/test/completion_test.yml deleted file mode 100644 index 5f5cdbad..00000000 --- a/account_statement_base_completion/test/completion_test.yml +++ /dev/null @@ -1,102 +0,0 @@ -- - In order to test the banking framework, I first need to create a profile -- - !record {model: account.statement.profile, id: profile_test1}: - name: Bank EUR Profile - journal_id: account.bank_journal - commission_account_id: account.a_expense - company_id: base.main_company - balance_check: True - rule_ids: - - bank_statement_completion_rule_4 - - bank_statement_completion_rule_5 - - bank_statement_completion_rule_2 - - bank_statement_completion_rule_3 -- - Now I create a statement. I create statment lines separately because I need - to find each one by XML id -- - !record {model: account.bank.statement, id: statement_test1}: - name: Statement 2 - profile_id: profile_test1 - company_id: base.main_company -- - I create a statement line for a CI -- - !record {model: account.bank.statement.line, id: statement_line_ci}: - name: Test autocompletion based on Customer Invoice Number - statement_id: statement_test1 - ref: CI0001 - date: '2013-12-20' - amount: 210.0 -- - I create a statement line for a SI -- - !record {model: account.bank.statement.line, id: statement_line_si}: - name: Test autocompletion based on Supplier Invoice Number - statement_id: statement_test1 - ref: T2S12345 - date: '2013-12-19' - amount: -65.0 -- - I create a statement line for a CR -- - !record {model: account.bank.statement.line, id: statement_line_cr}: - name: Test autocompletion based on Customer Refund Number - statement_id: statement_test1 - ref: CR0001 - date: '2013-12-19' - amount: -210.0 -- - I create a statement line for the Partner Name -- - !record {model: account.bank.statement.line, id: statement_line_partner_name}: - name: Test autocompletion based on Partner Name Vauxoo - statement_id: statement_test1 - ref: / - date: '2013-12-17' - amount: 600.0 -- - I create a statement line for the Partner Label -- - !record {model: account.bank.statement.line, id: statement_line_partner_label}: - name: test autocompletion based on text (XXX66Z) matching with partner form information (note that Ref does not exist) - statement_id: statement_test1 - ref: ZU788 - date: '2013-12-24' - amount: -932.4 -- - I run the auto complete -- - !python {model: account.bank.statement}: | - result = self.button_auto_completion(cr, uid, [ref("statement_test1")]) -- - Now I can check that all is nice and shiny, line 1. I expect the Customer - Invoice Number to be recognised. - I Use _ref, because ref conflicts with the field ref of the statement line -- - !assert {model: account.bank.statement.line, id: statement_line_ci, string: Check completion by CI number}: - - partner_id.id == _ref("base.res_partner_12") -- - Line 2. I expect the Supplier invoice number to be recognised. The supplier - invoice was created by the account module demo data, and we confirmed it - here. -- - !assert {model: account.bank.statement.line, id: statement_line_si, string: Check completion by SI number}: - - partner_id.id == _ref("base.res_partner_17") -- - Line 3. I expect the Customer refund number to be recognised. It should be - the commercial partner, and not the regular partner. -- - !assert {model: account.bank.statement.line, id: statement_line_cr, string: Check completion by CR number and commercial partner}: - - partner_id.id == _ref("base.res_partner_12") -- - Line 4. I check that the partner name has been recognised. -- - !assert {model: account.bank.statement.line, id: statement_line_partner_name, string: Check completion by partner name}: - - partner_id.name == 'Vauxoo' -- - Line 5. I check that the partner special label has been recognised. -- - !assert {model: account.bank.statement.line, id: statement_line_partner_label, string: Check completion by partner label}: - - partner_id.id == _ref("base.res_partner_6") diff --git a/account_statement_base_completion/test/invoice.yml b/account_statement_base_completion/test/invoice.yml deleted file mode 100644 index 5619f0cd..00000000 --- a/account_statement_base_completion/test/invoice.yml +++ /dev/null @@ -1,32 +0,0 @@ -- - I create a customer Invoice to be found by the completion. -- - !record {model: account.invoice, id: invoice_for_completion_1}: - account_id: account.a_recv - company_id: base.main_company - currency_id: base.EUR - internal_number: CI0001 - invoice_line: - - account_id: account.a_sale - name: '[PCSC234] PC Assemble SC234' - price_unit: 210.0 - quantity: 1.0 - product_id: product.product_product_3 - uos_id: product.product_uom_unit - journal_id: account.bank_journal - partner_id: base.res_partner_12 - reference_type: none -- - I confirm the Invoice -- - !workflow {model: account.invoice, action: invoice_open, ref: invoice_for_completion_1} -- - I check that the invoice state is "Open" -- - !assert {model: account.invoice, id: invoice_for_completion_1}: - - state == 'open' -- - I check that it is given the number "CI0001" -- - !assert {model: account.invoice, id: invoice_for_completion_1, string: Check CI number}: - - number == 'CI0001' diff --git a/account_statement_base_completion/tests/__init__.py b/account_statement_base_completion/tests/__init__.py deleted file mode 100644 index 6f9e09ea..00000000 --- a/account_statement_base_completion/tests/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# -# -# Authors: Laurent Mignon -# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu) -# 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 . -# -# - -from . import test_base_completion - -checks = [ - test_base_completion -] diff --git a/account_statement_base_import/README.rst b/account_statement_base_import/README.rst new file mode 100644 index 00000000..a4778540 --- /dev/null +++ b/account_statement_base_import/README.rst @@ -0,0 +1,102 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============================= +Account statement base import +============================= + +This module is a grouping of 7.0/8.0 modules, used to import accounting files +and completing them automatically: + +* account_statement_base_completion +* account_statement_base_import +* account_statement_commission +* account_statement_ext + +The main change is that, in order to import financial data, this information +is now imported directly as a Journal Entry. + +Most of the information present in the "statement profile" is now located in +the account journal (with an added boolean parameter which allows to use +this journal for importation). + +Financial data can be imported using a standard .csv or .xls file (you'll find +it in the 'data' folder). It respects the journal to pass the entries. + +This module can handle a commission taken by the payment office and has the +following format: +* __date__: date of the payment +* __amount__: amount paid in the currency of the journal used in the +importation +* __label__: the comunication given by the payment office, used as +communication in the generated entries. + +Another column which can be used is __commission_amount__, representing +the amount for the commission taken by line. + +Afterwards, the goal is to populate the journal items with information that +the bank or office gave you. For this, completion rules can be specified by +journal. + +Some basic rules are provided in this module: + +1) Match from statement line label (based on partner field 'Bank Statement +Label') +2) Match from statement line label (based on partner name) +3) Match from statement line label (based on Invoice reference) + +Feel free to extend either the importation method, the completion method, or +both. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +Known issues / Roadmap +====================== + +* ... + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Joël Grand-Guillaume +* Nicolas Bessi +* Sébastien Beau +* Matthieu Dietrich + +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 https://odoo-community.org. diff --git a/account_statement_base_import/__init__.py b/account_statement_base_import/__init__.py index aadbee9c..d4253a2c 100644 --- a/account_statement_base_import/__init__.py +++ b/account_statement_base_import/__init__.py @@ -1,23 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA -# -# 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 . -# -############################################################################## +# © 2011-2016 Camptocamp SA +# Joel Grand-Guillaume, Nicolas Bessi, Matthieu Dietrich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import parser from . import wizard from . import models diff --git a/account_statement_base_import/__openerp__.py b/account_statement_base_import/__openerp__.py index 3612ef25..a13218d2 100644 --- a/account_statement_base_import/__openerp__.py +++ b/account_statement_base_import/__openerp__.py @@ -1,76 +1,31 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA -# -# 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 . -# -############################################################################## +# © 2011-2016 Camptocamp SA +# Joel Grand-Guillaume, Nicolas Bessi, Matthieu Dietrich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -{'name': "Bank statement base import", - 'version': '1.2', - 'author': "Camptocamp,Odoo Community Association (OCA)", - 'maintainer': 'Camptocamp', - 'category': 'Finance', - 'complexity': 'normal', - 'depends': [ - 'account' - ], - 'description': """ - This module brings basic methods and fields on bank statement to deal with - the importation of different bank and offices. A generic abstract method is - defined and an example that gives you a basic way of importing bank statement - through a standard file is provided. - - This module improves the bank statement and allows you to import your bank - transactions with a standard .csv or .xls file (you'll find it in the 'data' - folder). It respects the profile (provided by the accouhnt_statement_ext - module) to pass the entries. That means, you'll have to choose a file format - for each profile. - In order to achieve this it uses the `xlrd` Python module which you will need - to install separately in your environment. - - This module can handle a commission taken by the payment office and has the - following format: - - * __ref__: the SO number, INV number or any matching ref found. It'll be used - as reference in the generated entries and will be useful for reconciliation - process - * __date__: date of the payment - * __amount__: amount paid in the currency of the journal used in the - importation profile - * __label__: the comunication given by the payment office, used as - communication in the generated entries. - - The goal is here to populate the statement lines of a bank statement with the - infos that the bank or office give you. Fell free to inherit from this module - to add your own format. Then, if you need to complete data from there, add - your own account_statement_*_completion module and implement the needed rules. - """, - 'website': 'http://www.camptocamp.com', - 'data': [ - "security/ir.model.access.csv", - "data/completion_rule_data.xml", - "wizard/import_statement_view.xml", - "views/account_move_view.xml", - "views/journal_view.xml", - "views/partner_view.xml", - ], - 'test': [], - 'installable': True, - 'images': [], - 'auto_install': False, - 'license': 'AGPL-3', - } +{ + 'name': "Bank statement base import", + 'version': '9.0.1.0.0', + 'author': "Akretion,Camptocamp,Odoo Community Association (OCA)", + 'category': 'Finance', + 'depends': ['account'], + 'website': 'http://www.camptocamp.com', + 'data': [ + "security/ir.model.access.csv", + "data/completion_rule_data.xml", + "wizard/import_statement_view.xml", + "views/account_move_view.xml", + "views/journal_view.xml", + "views/partner_view.xml", + ], + 'test': [ + 'test/partner.yml', + 'test/invoice.yml', + 'test/supplier_invoice.yml', + 'test/refund.yml', + 'test/completion_test.yml' + ], + 'installable': True, + 'auto_install': False, + 'license': 'AGPL-3', +} diff --git a/account_statement_base_import/data/completion_rule_data.xml b/account_statement_base_import/data/completion_rule_data.xml index b06ac51a..ae1ba858 100644 --- a/account_statement_base_import/data/completion_rule_data.xml +++ b/account_statement_base_import/data/completion_rule_data.xml @@ -14,9 +14,15 @@ - Match from line label (based on Invoice reference) + Match from line label (based on Invoice number) 40 get_from_name_and_invoice + + Match from line label (based on Invoice Supplier number) + 45 + get_from_name_and_supplier_invoice + + diff --git a/account_statement_base_import/data/statement.xls b/account_statement_base_import/data/statement.xls index 53ba58a543a9615691535ad304f41bd975a95eb3..5f5a57b061a3ad1b1879524ffb0f8aeb3013df4f 100644 GIT binary patch literal 7168 zcmeHLYiv|S6h3!%TW)Eg+fqskQZ5Awr7iTK@)B5RizRWPsh}|-!R@jw3)?Pfw~8^w z^7?3x}8i@XRLwI*`@H{?fXP5EfG0rmfP7#IPykE?3V~@r z5l{?F2W9~G05gFSU>0Bivw>1z4loy(2b2NxfdxQ0un?#KDuF6s5wIAj25Nv>pbp@^ z?z2kPm!iH5SPrZJ9so#RWt9o7-MzIe9jBO?As!k4w_N9xUHkyr7THDH zsP~2Z#($O8sx|mD+GZb&bfuPwSi=E3J&Js?ys3K5sC=ceKn(PV!82!6avBZt9#na$ z$|ob&OJZ(CU@U zptLIaC9WJf!B_af#tn@vYaS|b70N5TZ4C{Jz23!-A#E|5nwERLC9YZWD(N7~^z7_q~)aYFAaO0EFIqPua|G)GT(5b=g zSt+jP3R4f!q4e@3^vWdkg-PgH!_qTgMjBo4(!4_5rQ;r(>q*dkgXjV?Q|q6bmuDX@ zFtQQpmA--ThaC{pD>0VtUZ*PadNWm--|JH4l->!dEa=UMJ+7|g0X!(5GXBK1SQqFC zhC+cF(q=FQP0(sd`-?GYf>!q&9F&INIZX#dHXYRDC)vSgD%#4Sk{RW5!Z!?SQ_mfr zJX$|N>tz|I)k$`g&)P?jq01f(OVIl?4|0!`T;s!shfv34IvzUx54?ppr9}nJ^rDck z%@+wEj`nqgdpaYyw*GKON3gp)81CF^(y-BxuQd?DcvTv{fm-W8%^ySXt;=Q%=Hu(v zrvj*0iH|LlgW51XxqFZ&&%wsFK?(GGd1{kxOn39-wXeOc&8xR6dM_yPG>-=-^Rzwa zIpNnlsd%^X zijOj`+1DO0%9{5n0sB>6hQ-vWbanN7TYUlQ`>HPNt-26hU2dx%hmXs`7J2rX?3GHb zQj7D)OHDRo?reER=@4N+5rY>|ZE`&^CDC?ZvJwi6cd$?QZM>d{`zHrwK0AY|H; znd=T(2J1~UCXCG$(%5i8t#%qMZYYh`XQ$m#pI&BAC1SQTgjk%&Y&p>4OlHf8(2H|8 zu`-UCCL795K2rPbkDjx5BDvQhalX&MY~L@jm_u=C;3$SvlZ$hiTrYfMa?x~(<}o@-Dw!#lsBuk?9z^%Ml{Z!iQCSL@7C%55Fn{s*72Lw8}xUDyTfe}qj9%C5Hgl6 zsoKP6I}}iUY;CZu&HUsrdD70|^h}{?bD9kOa96yiLld3pr2{Wrzp-(<`_%KgRLnnp zkxsP;9sGu8|1N->y8*h!{Qw_=LjaHBC_sPu8o;pT9f0n#4`58jFBm$?D**o=;1>kL z6i!YVIVd^*)m!E_KV>rU`~P<849vW~NMw63&|@?N1Cg$vf4em=<#C@LAf7z&3d*7N zKf`A~^dI{wz8u@g)T+t!&viJ?e}4Yxq8aYPN1*@88*em#mNA631+*f73n1J8d8xBx zbaand8q5Fx)cS|qq2U%vTkEr8s7LYdW0&m2S1!*pUkBpfQxs{ZKa3pw1+XdqH1s^=XhBl0cG?qmw5>zA4$vN9Pc^ zAA<_4ff@3!^kDxT`1gVT{jSHqz-{VGNQvN|kT598(*jFA{Y9$#UxKk#fDAv=011Az lhJgA9I=%HQ{TKUR3Hg!aTS~hpUH#kte@$E1FbuaN|8JkruzUaj literal 6656 zcmeHLZ){Ul6hH4zw~oIp41|H>(Lvc*H@YpuAu1be{EHg|(ZslfbX_OKcGYe}jWJdb zjR_JJ6Z}A;#7RO(Obm&Mi3W&Y{0vgFZfF=QlNCM6EOhVm4Vx!xrQbd(FJhLO93}f2Jqd~Y<>q#ZE~nZSYVqZ@C=G29nz0HDbHf1i>JBRG0tv^ zY3cMA#mJ8*GueO60^`|=@16Fi|E3=|fU(X$eLm0sG+;U~1DFXQ1c(=y1rX|)?pqI3%Q4(P@@nd?Haur)TVMXMjo!$@by{c1m;VXIgz z$aqIMfr^gOYby1rbOusQzE$N0?48f?KK;V$8ZwBw+LF;wEXV(Z%|TASZp#< z?~tD>7g2MIl1Cq=Qoc*-Tnx)^X-iI7P!1xG69ezp@pznQzFZ+5_2$dnnY>}x zCf`=IoZHo#ZB(kD1J&^52*}Jo5Pi~>_-Tx!Sf;{PMgbB%UYH0QEkd)u~`0fe&6hSQ|z%9>@4ay80( z>n`l6yKr?)jiY=-e7M{8VuF13NI(l{c6&S5R`8-B) zC(qOwyBV1cNk;lionc%(`iFYeI~djE(fI)U9W7oVzeBh}!av#S z^qbW6P#q1DQP*(Ks-~b)XDD^=JvVavP*$B$P#wnT7+v@Qtkg&9lNd2p-o?urX~dld zrw^TgXbIB){#?-%T<{{!Ro*$s7*IsnT2*N4NgL<6CI)ZbgTfsr#b6pw(~uUc_UlT@1@RYIGGqo^bJ}a&x9i}tGPZ{ zx1D}B7JZK{(tVLVC-UB z+ITEJUQg10!~(bT|BqV#yggiKnmkA;9!$_$_5bOKOl1P;6zn$cH|pdWDpo}m9R)~} zEfN!+_=yqwXTLTTqooEy{8vJ9$wM+EaXcaQ?`;$Q!u7!>NyQnID9ZgA(Sm6;`nPY6 z9792&JmzxL&t-X. -# -############################################################################## +# © 2011-2016 Camptocamp SA +# Joel Grand-Guillaume, Nicolas Bessi, Matthieu Dietrich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import sys import traceback import os @@ -223,10 +207,10 @@ class AccountJournal(models.Model): if filename: (filename, __) = os.path.splitext(filename) parser = new_move_parser(self, ftype=ftype, move_ref=filename) - res = [] + res = self.env['account.move'] for result_row_list in parser.parse(file_stream): move = self._move_import(parser, file_stream, ftype=ftype) - res.append(move) + res |= move return res def _move_import(self, parser, file_stream, ftype="csv"): diff --git a/account_statement_base_import/models/account_move.py b/account_statement_base_import/models/account_move.py index cc68b393..9266599d 100644 --- a/account_statement_base_import/models/account_move.py +++ b/account_statement_base_import/models/account_move.py @@ -1,23 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi, Joel Grand-Guillaume -# Copyright 2011-2012 Camptocamp SA -# -# 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 . -# -############################################################################## +# © 2011-2016 Camptocamp SA +# Joel Grand-Guillaume, Nicolas Bessi, Matthieu Dietrich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # TODO replace customer supplier by package constant import traceback import sys @@ -65,7 +49,9 @@ class AccountMoveCompletionRule(models.Model): Override this to add you own.""" return [ ('get_from_name_and_invoice', - 'From line name (based on invoice reference)'), + 'From line name (based on customer invoice number)'), + ('get_from_name_and_supplier_invoice', + 'From line name (based on supplier invoice number)'), ('get_from_name_and_partner_field', 'From line name (based on partner field)'), ('get_from_name_and_partner_name', @@ -90,6 +76,62 @@ class AccountMoveCompletionRule(models.Model): __get_functions, string='Method') + def _find_invoice(self, line, inv_type): + """Find invoice related to statement line""" + inv_obj = self.env['account.invoice'] + if inv_type == 'supplier': + type_domain = ('in_invoice', 'in_refund') + number_field = 'reference' + elif inv_type == 'customer': + type_domain = ('out_invoice', 'out_refund') + number_field = 'number' + else: + raise ValidationError( + _('Invalid invoice type for completion: %') % inv_type) + + invoices = inv_obj.search([(number_field, '=', line.name.strip()), + ('type', 'in', type_domain)]) + if invoices: + if len(invoices) == 1: + invoice = invoices[0] + else: + raise ErrorTooManyPartner( + _('Line named "%s" was matched by more than one ' + 'partner while looking on %s invoices') % + (line.name, inv_type)) + return invoice + return False + + def _from_invoice(self, line, inv_type): + """Populate statement line values""" + if inv_type not in ('supplier', 'customer'): + raise ValidationError( + _('Invalid invoice type for completion: %') % + inv_type) + res = {} + invoice = self._find_invoice(line, inv_type) + if invoice: + partner_id = invoice.commercial_partner_id.id + res = {'partner_id': partner_id} + return res + + # Should be private but data are initialised with no update XML + def get_from_name_and_supplier_invoice(self, line): + """Match the partner based on the invoice number and the reference of + the statement line. Then, call the generic get_values_for_line method + to complete other values. If more than one partner matched, raise the + ErrorTooManyPartner error. + + :param dict line: read of the concerned account.bank.statement.line + :return: + A dict of value that can be passed directly to the write method of + the statement line or {} + {'partner_id': value, + 'account_id': value, + ...} + """ + return self._from_invoice(line, 'supplier') + # Should be private but data are initialised with no update XML def get_from_name_and_invoice(self, line): """Match the partner based on the invoice number and the reference of @@ -105,20 +147,7 @@ class AccountMoveCompletionRule(models.Model): 'account_id': value, ...} """ - res = {} - inv_obj = self.env['account.invoice'] - invoices = inv_obj.search([('name', '=', line.name.strip())]) - if invoices: - if len(invoices) == 1: - invoice = invoices[0] - partner_id = invoice.commercial_partner_id.id - res = {'partner_id': partner_id} - else: - raise ErrorTooManyPartner( - _('Line named "%s" (Ref:%s) was matched by more than one ' - 'partner while looking on invoices') % - (line.name)) - return res + return self._from_invoice(line, 'customer') # Should be private but data are initialised with no update XML def get_from_name_and_partner_field(self, line): @@ -140,7 +169,7 @@ class AccountMoveCompletionRule(models.Model): """ res = {} partner_obj = self.env['res.partner'] - or_regex = ".*; *%s *;.*" % line.name + or_regex = ".*;? *%s *;?.*" % line.name sql = ("SELECT id from res_partner" " WHERE bank_statement_label ~* %s") self.env.cr.execute(sql, (or_regex, )) diff --git a/account_statement_base_import/models/partner.py b/account_statement_base_import/models/partner.py index 8087f5f4..9677fa12 100644 --- a/account_statement_base_import/models/partner.py +++ b/account_statement_base_import/models/partner.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -########################################################################## -# -# Copyright (C) 2011 Akretion & Camptocamp -# Author : Sébastien BEAU, Joel Grand-Guillaume -# -# 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 . -# -########################################################################## - +# © 2011-2016 Camptocamp SA +# Joel Grand-Guillaume, Nicolas Bessi, Matthieu Dietrich +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import fields, models diff --git a/account_statement_base_import/test/completion_test.yml b/account_statement_base_import/test/completion_test.yml new file mode 100644 index 00000000..2f020200 --- /dev/null +++ b/account_statement_base_import/test/completion_test.yml @@ -0,0 +1,125 @@ +- + In order to test the banking framework, I first need to create a journal +- + !record {model: account.journal, id: account.bank_journal}: + used_for_import: True + partner_id: base.res_partner_12 + commission_account_id: account.a_expense + receivable_account_id: account.a_expense + rule_ids: + - bank_statement_completion_rule_4 + - bank_statement_completion_rule_2 + - bank_statement_completion_rule_3 + - bank_statement_completion_rule_5 +- + Now I create a statement. I create statment lines separately because I need + to find each one by XML id +- + !record {model: account.move, id: move_test1}: + name: Move 2 + journal_id: account.bank_journal + company_id: base.main_company +- + I create a move line for a CI +- + !record {model: account.move.line, id: move_line_ci}: + name: \ + account_id: account.a_sale + move_id: move_test1 + date_maturity: '2013-12-20' + credit: 0.0 +- + I create a move line for a SI +- + !record {model: account.move.line, id: move_line_si}: + name: \ + account_id: account.a_expense + move_id: move_test1 + date_maturity: '2013-12-19' + debit: 0.0 +- + I create a move line for a CR +- + !record {model: account.move.line, id: move_line_cr}: + name: \ + account_id: account.a_expense + move_id: move_test1 + date_maturity: '2013-12-19' + debit: 0.0 +- + I create a move line for the Partner Name +- + !record {model: account.move.line, id: move_line_partner_name}: + name: Test autocompletion based on Partner Name Camptocamp + account_id: account.a_sale + move_id: move_test1 + date_maturity: '2013-12-17' + credit: 0.0 +- + I create a move line for the Partner Label +- + !record {model: account.move.line, id: move_line_partner_label}: + name: XXX66Z + account_id: account.a_sale + move_id: move_test1 + date_maturity: '2013-12-24' + debit: 0.0 +- + and add the correct name +- + !python {model: account.move.line}: | + import datetime as dt + context['check_move_validity'] = False + model.write(cr, uid, [ref('move_line_ci')], + {'name': dt.date.today().strftime('TBNK/%Y/0001'), + 'credit': 210.0}, + context) + model.write(cr, uid, [ref('move_line_si')], + {'name': 'T2S12345', + 'debit': 65.0}, + context) + model.write(cr, uid, [ref('move_line_cr')], + {'name': dt.date.today().strftime('RTEXJ/%Y/0001'), + 'debit': 210.0}, + context) + model.write(cr, uid, [ref('move_line_partner_name')], + {'credit': 600.0}, + context) + model.write(cr, uid, [ref('move_line_partner_label')], + {'debit': 932.4}, + context) +- + I run the auto complete +- + !python {model: account.move}: | + result = self.button_auto_completion(cr, uid, [ref("move_test1")]) +- + Now I can check that all is nice and shiny, line 1. I expect the Customer + Invoice Number to be recognised. + I Use _ref, because ref conflicts with the field ref of the statement line +- + !assert {model: account.move.line, id: move_line_ci, string: Check completion by CI number}: + - partner_id.id == _ref("base.res_partner_12") +- + Line 2. I expect the Supplier invoice number to be recognised. The supplier + invoice was created by the account module demo data, and we confirmed it + here. +- + !assert {model: account.move.line, id: move_line_si, string: Check completion by SI number}: + - partner_id.id == _ref("base.res_partner_12") +- + Line 3. I expect the Customer refund number to be recognised. It should be + the commercial partner, and not the regular partner. +- + !assert {model: account.move.line, id: move_line_cr, string: Check completion by CR number and commercial partner}: + - partner_id.id == _ref("base.res_partner_12") +- + Line 4. I check that the partner name has been recognised. +- + !assert {model: account.move.line, id: move_line_partner_name, string: Check completion by partner name}: + - partner_id.name == 'Camptocamp' +- + Line 5. I check that the partner special label has been recognised. +- + !assert {model: account.move.line, id: move_line_partner_label, string: Check completion by partner label}: + - partner_id.id == _ref("base.res_partner_4") diff --git a/account_statement_base_import/test/invoice.yml b/account_statement_base_import/test/invoice.yml new file mode 100644 index 00000000..5379f670 --- /dev/null +++ b/account_statement_base_import/test/invoice.yml @@ -0,0 +1,42 @@ +- + I import account minimal data +- + !python {model: account.invoice}: | + openerp.tools.convert_file(cr, + 'account', + openerp.modules.get_module_resource( + 'account', + 'test', + 'account_minimal_test.xml'), + {}, 'init', False, 'test') +- + I create a customer Invoice to be found by the completion. +- + !record {model: account.invoice, id: invoice_for_completion_1}: + company_id: base.main_company + currency_id: base.EUR + invoice_line_ids: + - name: '[PCSC234] PC Assemble SC234' + price_unit: 210.0 + quantity: 1.0 + product_id: product.product_product_3 + uom_id: product.product_uom_unit + journal_id: account.bank_journal + partner_id: base.res_partner_12 + reference_type: none +- + I confirm the Invoice +- + !workflow {model: account.invoice, action: invoice_open, ref: invoice_for_completion_1} +- + I check that the invoice state is "Open" +- + !assert {model: account.invoice, id: invoice_for_completion_1}: + - state == 'open' +- + I check that it is given the number "TBNK/%Y/0001" +- + !python {model: account.invoice}: | + import datetime as dt + invoice = model.browse(cr, uid, ref('invoice_for_completion_1'), context) + assert invoice.number == dt.date.today().strftime('TBNK/%Y/0001') diff --git a/account_statement_base_completion/test/partner.yml b/account_statement_base_import/test/partner.yml similarity index 62% rename from account_statement_base_completion/test/partner.yml rename to account_statement_base_import/test/partner.yml index bc8fca6c..5e207100 100644 --- a/account_statement_base_completion/test/partner.yml +++ b/account_statement_base_import/test/partner.yml @@ -1,5 +1,5 @@ - I fill in the field Bank Statement Label in a Partner - - !record {model: res.partner, id: base.res_partner_6}: + !record {model: res.partner, id: base.res_partner_4}: bank_statement_label: XXX66Z diff --git a/account_statement_base_completion/test/refund.yml b/account_statement_base_import/test/refund.yml similarity index 71% rename from account_statement_base_completion/test/refund.yml rename to account_statement_base_import/test/refund.yml index f8c07909..2779ba73 100644 --- a/account_statement_base_completion/test/refund.yml +++ b/account_statement_base_import/test/refund.yml @@ -12,17 +12,14 @@ I create a customer refund to be found by the completion. - !record {model: account.invoice, id: refund_for_completion_1}: - account_id: account.a_pay company_id: base.main_company currency_id: base.EUR - internal_number: CR0001 - invoice_line: - - account_id: account.a_expense - name: '[PCSC234] PC Assemble SC234' + invoice_line_ids: + - name: '[PCSC234] PC Assemble SC234' price_unit: 210.0 quantity: 1.0 product_id: product.product_product_3 - uos_id: product.product_uom_unit + uom_id: product.product_uom_unit journal_id: account.expenses_journal partner_id: res_partner_12_child type: 'out_refund' @@ -37,7 +34,9 @@ !assert {model: account.invoice, id: refund_for_completion_1}: - state == 'open' - - I check that it is given the number "CR0001" + I check that it is given the number "RTEXJ/%Y/0001" - - !assert {model: account.invoice, id: refund_for_completion_1, string: Check CI number}: - - number == 'CR0001' + !python {model: account.invoice}: | + import datetime as dt + invoice = model.browse(cr, uid, ref('refund_for_completion_1'), context) + assert invoice.number == dt.date.today().strftime('RTEXJ/%Y/0001') diff --git a/account_statement_base_completion/test/supplier_invoice.yml b/account_statement_base_import/test/supplier_invoice.yml similarity index 66% rename from account_statement_base_completion/test/supplier_invoice.yml rename to account_statement_base_import/test/supplier_invoice.yml index 1bd826f9..4ac8e87d 100644 --- a/account_statement_base_completion/test/supplier_invoice.yml +++ b/account_statement_base_import/test/supplier_invoice.yml @@ -1,3 +1,14 @@ +- + I import account minimal data +- + !python {model: account.invoice}: | + openerp.tools.convert_file(cr, + 'account', + openerp.modules.get_module_resource( + 'account', + 'demo', + 'account_invoice_demo.yml'), + {}, 'init', False, 'test') - I check that my invoice is a supplier invoice - @@ -8,7 +19,7 @@ - !python {model: account.invoice}: | self.write(cr, uid, ref('account.demo_invoice_0'), { - 'supplier_invoice_number': 'T2S12345' + 'reference': 'T2S12345' }) - I check a second time that my invoice is still a supplier invoice @@ -23,7 +34,7 @@ I check that the supplier number is there - !assert {model: account.invoice, id: account.demo_invoice_0, string: Check supplier number}: - - supplier_invoice_number == 'T2S12345' + - reference == 'T2S12345' - I check a third time that my invoice is still a supplier invoice - diff --git a/account_statement_base_import/tests/test_base_completion.py b/account_statement_base_import/tests/test_base_completion.py index 9fd9adb5..d48d6769 100644 --- a/account_statement_base_import/tests/test_base_completion.py +++ b/account_statement_base_import/tests/test_base_completion.py @@ -19,8 +19,9 @@ # along with this program. If not, see . # # +from openerp import fields, tools +from openerp.modules import get_module_resource from openerp.tests import common -import time from collections import namedtuple name_completion_case = namedtuple( @@ -51,17 +52,17 @@ class base_completion(common.TransactionCase): def setUp(self): super(base_completion, self).setUp() + tools.convert_file(self.cr, 'account', + get_module_resource('account', 'test', + 'account_minimal_test.xml'), + {}, 'init', False, 'test') + self.account_move_obj = self.env["account.move"] + self.account_move_line_obj = \ + self.env["account.move.line"] self.company_a = self.browse_ref('base.main_company') - self.profile_obj = self.registry("account.statement.profile") - self.partner_obj = self.registry("res.partner") - self.account_bank_statement_obj = self.registry( - "account.bank.statement") - self.account_bank_statement_line_obj = self.registry( - "account.bank.statement.line") - self.journal_id = self.ref("account.bank_journal") - self.partner_id = self.ref('base.main_partner') + self.journal = self.browse_ref("account.bank_journal") + self.partner = self.browse_ref("base.res_partner_12") self.account_id = self.ref("account.a_recv") - self.partner_id = self.ref("base.res_partner_12") def test_name_completion(self): """Test complete partner_id from statement line label @@ -69,54 +70,44 @@ class base_completion(common.TransactionCase): the partner appears in the statement line label """ self.completion_rule_id = self.ref( - 'account_statement_base_completion.' - 'bank_statement_completion_rule_3') + 'account_statement_base_import.bank_statement_completion_rule_3') # Create the profile - self.profile_id = self.profile_obj.create(self.cr, self.uid, { - "name": "TEST", - "commission_account_id": self.account_id, - "journal_id": self.journal_id, - "rule_ids": [(6, 0, [self.completion_rule_id])]}) + self.journal.write({ + 'used_for_import': True, + 'partner_id': self.partner.id, + 'commission_account_id': self.account_id, + 'receivable_account_id': self.account_id, + 'rule_ids': [(6, 0, [self.completion_rule_id])] + }) # Create a bank statement - self.statement_id = self.account_bank_statement_obj.create( - self.cr, self.uid, { - "balance_end_real": 0.0, - "balance_start": 0.0, - "date": time.strftime('%Y-%m-%d'), - "journal_id": self.journal_id, - "profile_id": self.profile_id - }) + self.move = self.account_move_obj.create({ + "date": fields.Date.today(), + "journal_id": self.journal.id + }) for case in NAMES_COMPLETION_CASES: - self.partner_obj.write( - self.cr, self.uid, self.partner_id, {'name': case.partner_name} - ) - statement_line_id = self.account_bank_statement_line_obj.create( - self.cr, self.uid, { - 'amount': 1000.0, - 'name': case.line_label, - 'ref': 'My ref', - 'statement_id': self.statement_id, - }) - statement_line = self.account_bank_statement_line_obj.browse( - self.cr, self.uid, statement_line_id) + self.partner.write({'name': case.partner_name}) + self.move_line = self.account_move_line_obj.with_context( + check_move_validity=False + ).create({ + 'account_id': self.account_id, + 'credit': 1000.0, + 'name': case.line_label, + 'move_id': self.move.id, + }) self.assertFalse( - statement_line.partner_id, + self.move_line.partner_id, "Partner_id must be blank before completion") - statement_obj = self.account_bank_statement_obj.browse( - self.cr, self.uid, self.statement_id) - statement_obj.button_auto_completion() - statement_line = self.account_bank_statement_line_obj.browse( - self.cr, self.uid, statement_line_id) + self.move.button_auto_completion() if case.should_match: self.assertEquals( - self.partner_id, statement_line.partner_id['id'], + self.partner, self.move_line.partner_id, "Missing expected partner id after completion " "(partner_name: %s, line_name: %s)" % (case.partner_name, case.line_label)) else: self.assertNotEquals( - self.partner_id, statement_line.partner_id['id'], + self.partner, self.move_line.partner_id, "Partner id should be empty after completion " "(partner_name: %s, line_name: %s)" % (case.partner_name, case.line_label)) diff --git a/account_statement_base_import/tests/test_base_import.py b/account_statement_base_import/tests/test_base_import.py index eea31069..1b8e1f85 100644 --- a/account_statement_base_import/tests/test_base_import.py +++ b/account_statement_base_import/tests/test_base_import.py @@ -23,38 +23,32 @@ import base64 import inspect import os from openerp.tests import common +from openerp import tools +from openerp.modules import get_module_resource class TestCodaImport(common.TransactionCase): - def prepare(self): + def setUp(self): + super(TestCodaImport, self).setUp() self.company_a = self.browse_ref('base.main_company') - self.profile_obj = self.registry("account.statement.profile") - self.account_bank_statement_obj = self.registry( - "account.bank.statement") - # create the 2009 fiscal year since imported coda file reference - # statement lines in 2009 - self.fiscalyear_id = self._create_fiscalyear("2011", self.company_a.id) + tools.convert_file(self.cr, 'account', + get_module_resource('account', 'test', + 'account_minimal_test.xml'), + {}, 'init', False, 'test') + self.account_move_obj = self.env["account.move"] + self.account_move_line_obj = self.env["account.move.line"] self.account_id = self.ref("account.a_recv") - self.journal_id = self.ref("account.bank_journal") - self.import_wizard_obj = self.registry('credit.statement.import') - self.profile_id = self.profile_obj.create(self.cr, self.uid, { - "name": "BASE_PROFILE", - "commission_account_id": self.account_id, - "journal_id": self.journal_id, - "import_type": "generic_csvxls_so"}) - - def _create_fiscalyear(self, year, company_id): - fiscalyear_obj = self.registry("account.fiscalyear") - fiscalyear_id = fiscalyear_obj.create(self.cr, self.uid, { - "name": year, - "code": year, - "date_start": year + "-01-01", - "date_stop": year + "-12-31", - "company_id": company_id + self.journal = self.browse_ref("account.bank_journal") + self.import_wizard_obj = self.env['credit.statement.import'] + self.partner = self.browse_ref("base.res_partner_12") + self.journal.write({ + 'used_for_import': True, + "import_type": "generic_csvxls_so", + 'partner_id': self.partner.id, + 'commission_account_id': self.account_id, + 'receivable_account_id': self.account_id, }) - fiscalyear_obj.create_period3(self.cr, self.uid, [fiscalyear_id]) - return fiscalyear_id def _filename_to_abs_filename(self, file_name): dir_name = os.path.dirname(inspect.getfile(self.__class__)) @@ -66,45 +60,35 @@ class TestCodaImport(common.TransactionCase): """ with open(file_name) as f: content = f.read() - wizard_id = self.import_wizard_obj.create(self.cr, self.uid, { - "profile_id": self.profile_id, + self.wizard = self.import_wizard_obj.create({ + "journal_id": self.journal.id, 'input_statement': base64.b64encode(content), 'file_name': os.path.basename(file_name), }) - res = self.import_wizard_obj.import_statement( - self.cr, self.uid, wizard_id) - statement_id = self.account_bank_statement_obj.search( - self.cr, self.uid, eval(res['domain'])) - return self.account_bank_statement_obj.browse( - self.cr, self.uid, statement_id)[0] + res = self.wizard.import_statement() + return self.account_move_obj.browse(res['res_id']) def test_simple_xls(self): """Test import from xls """ - self.prepare() file_name = self._filename_to_abs_filename( os.path.join("..", "data", "statement.xls")) - statement = self._import_file(file_name) - self._validate_imported_satement(statement) + move = self._import_file(file_name) + self._validate_imported_move(move) def test_simple_csv(self): """Test import from csv """ - self.prepare() file_name = self._filename_to_abs_filename( os.path.join("..", "data", "statement.csv")) - statement = self._import_file(file_name) - self._validate_imported_satement(statement) + move = self._import_file(file_name) + self._validate_imported_move(move) - def _validate_imported_satement(self, statement): - self.assertEqual("/", statement.name) - self.assertEqual(0.0, statement.balance_start) - self.assertEqual(0.0, statement.balance_end_real) - self.assertEqual(3, len(statement.line_ids)) - self.assertTrue(statement.account_id) - st_line_obj = statement.line_ids[1] + def _validate_imported_move(self, move): + self.assertEqual("/", move.name) + self.assertEqual(5, len(move.line_ids)) + move_line = move.line_ids[4] # common infos - self.assertEqual(st_line_obj.ref, "51065326") - self.assertEqual(st_line_obj.date, "2011-03-02") - self.assertEqual(st_line_obj.amount, 189.0) - self.assertEqual(st_line_obj.name, "label b") + self.assertEqual(move_line.date_maturity, "2011-03-02") + self.assertEqual(move_line.credit, 189.0) + self.assertEqual(move_line.name, "label b") diff --git a/account_statement_base_import/views/journal_view.xml b/account_statement_base_import/views/journal_view.xml index 6e7bbf15..c14dfdd0 100644 --- a/account_statement_base_import/views/journal_view.xml +++ b/account_statement_base_import/views/journal_view.xml @@ -11,14 +11,14 @@ - + - + - - - + + +