From 9d01cc9e77b263a35173b41046a88af9bb8c72db Mon Sep 17 00:00:00 2001 From: mpanarin Date: Thu, 4 Jan 2018 19:22:56 +0200 Subject: [PATCH] [MIG] account_mass_reconcile: Migration to odoo 11 --- account_mass_reconcile/README.rst | 7 +- account_mass_reconcile/__init__.py | 2 - account_mass_reconcile/__manifest__.py | 29 +- .../i18n/account_easy_reconcile.pot | 602 ------------------ account_mass_reconcile/models/__init__.py | 2 - .../models/advanced_reconciliation.py | 19 +- .../models/base_advanced_reconciliation.py | 37 +- .../models/base_reconciliation.py | 43 +- .../models/mass_reconcile.py | 185 +++--- .../models/mass_reconcile_history.py | 22 +- account_mass_reconcile/models/res_config.py | 15 +- .../models/simple_reconciliation.py | 15 +- account_mass_reconcile/security/ir_rule.xml | 44 +- account_mass_reconcile/tests/__init__.py | 1 - .../tests/test_onchange_company.py | 20 +- .../tests/test_reconcile.py | 63 +- .../tests/test_reconcile_history.py | 26 +- .../tests/test_scenario_reconcile.py | 64 +- .../views/mass_reconcile.xml | 9 +- .../views/res_config_view.xml | 32 +- 20 files changed, 321 insertions(+), 916 deletions(-) delete mode 100644 account_mass_reconcile/i18n/account_easy_reconcile.pot diff --git a/account_mass_reconcile/README.rst b/account_mass_reconcile/README.rst index cd0dd12c..3f3f077d 100644 --- a/account_mass_reconcile/README.rst +++ b/account_mass_reconcile/README.rst @@ -36,13 +36,13 @@ new mass reconcile. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/98/10.0 + :target: https://runbot.odoo-community.org/runbot/98/11.0 Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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. @@ -57,7 +57,7 @@ Contributors * Vincent Renaville * Alexandre Fayolle * Joël Grand-Guillaume -* Nicolas Bessis +* Nicolas Bessi * Pedro M.Baeza * Matthieu Dietrich * Leonardo Pistone @@ -69,6 +69,7 @@ Contributors * Frédéric Clémenti * Damien Crier * Akim Juillerat +* Mykhailo Panarin Maintainer ---------- diff --git a/account_mass_reconcile/__init__.py b/account_mass_reconcile/__init__.py index cde864ba..0650744f 100755 --- a/account_mass_reconcile/__init__.py +++ b/account_mass_reconcile/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/account_mass_reconcile/__manifest__.py b/account_mass_reconcile/__manifest__.py index ccc9828a..0598772e 100644 --- a/account_mass_reconcile/__manifest__.py +++ b/account_mass_reconcile/__manifest__.py @@ -1,23 +1,22 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Mass Reconcile", - "version": "10.0.1.0.0", - "depends": ["account"], + "version": "11.0.1.0.0", + "depends": [ + "account_invoicing", + ], "author": "Akretion,Camptocamp,Odoo Community Association (OCA)", - "website": "http://www.akretion.com/", + "website": "https://github.com/OCA/account-reconcile", "category": "Finance", - "data": ["views/mass_reconcile.xml", - "views/mass_reconcile_history_view.xml", - "security/ir_rule.xml", - "security/ir.model.access.csv", - "views/res_config_view.xml", - ], + "data": [ + "views/mass_reconcile.xml", + "views/mass_reconcile_history_view.xml", + "security/ir_rule.xml", + "security/ir.model.access.csv", + "views/res_config_view.xml", + ], 'license': 'AGPL-3', - "auto_install": False, - 'installable': True, - } diff --git a/account_mass_reconcile/i18n/account_easy_reconcile.pot b/account_mass_reconcile/i18n/account_easy_reconcile.pot deleted file mode 100644 index 4c7c81dc..00000000 --- a/account_mass_reconcile/i18n/account_easy_reconcile.pot +++ /dev/null @@ -1,602 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_mass_reconcile -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-12 14:08+0000\n" -"PO-Revision-Date: 2015-06-12 14:08+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_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "7 Days" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.actions.act_window,help:account_mass_reconcile.action_account_mass_reconcile -msgid "

\n" -" Click to add a reconciliation profile.\n" -"

\n" -" A reconciliation profile specifies, for one account, how\n" -" the entries should be reconciled.\n" -" You can select one or many reconciliation methods which will\n" -" be run sequentially to match the entries between them.\n" -"

\n" -" " -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,account:0 -#: field:mass.reconcile.advanced,account_id:0 -#: field:mass.reconcile.advanced.ref,account_id:0 -#: field:mass.reconcile.base,account_id:0 -#: field:mass.reconcile.simple,account_id:0 -#: field:mass.reconcile.simple.name,account_id:0 -#: field:mass.reconcile.simple.partner,account_id:0 -#: field:mass.reconcile.simple.reference,account_id:0 -msgid "Account" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,account_lost_id:0 -#: field:mass.reconcile.advanced,account_lost_id:0 -#: field:mass.reconcile.advanced.ref,account_lost_id:0 -#: field:mass.reconcile.base,account_lost_id:0 -#: field:mass.reconcile.options,account_lost_id:0 -#: field:mass.reconcile.simple,account_lost_id:0 -#: field:mass.reconcile.simple.name,account_lost_id:0 -#: field:mass.reconcile.simple.partner,account_lost_id:0 -#: field:mass.reconcile.simple.reference,account_lost_id:0 -msgid "Account Lost" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,account_profit_id:0 -#: field:mass.reconcile.advanced,account_profit_id:0 -#: field:mass.reconcile.advanced.ref,account_profit_id:0 -#: field:mass.reconcile.base,account_profit_id:0 -#: field:mass.reconcile.options,account_profit_id:0 -#: field:mass.reconcile.simple,account_profit_id:0 -#: field:mass.reconcile.simple.name,account_profit_id:0 -#: field:mass.reconcile.simple.partner,account_profit_id:0 -#: field:mass.reconcile.simple.reference,account_profit_id:0 -msgid "Account Profit" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile.method,analytic_account_id:0 -#: help:mass.reconcile.base,analytic_account_id:0 -#: help:mass.reconcile.options,analytic_account_id:0 -#: help:mass.reconcile.simple,analytic_account_id:0 -#: help:mass.reconcile.simple.name,analytic_account_id:0 -#: help:mass.reconcile.simple.partner,analytic_account_id:0 -#: help:mass.reconcile.simple.reference,analytic_account_id:0 -msgid "Analytic accountfor the write-off" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,analytic_account_id:0 -#: field:mass.reconcile.base,analytic_account_id:0 -#: field:mass.reconcile.options,analytic_account_id:0 -#: field:mass.reconcile.simple,analytic_account_id:0 -#: field:mass.reconcile.simple.name,analytic_account_id:0 -#: field:mass.reconcile.simple.partner,analytic_account_id:0 -#: field:mass.reconcile.simple.reference,analytic_account_id:0 -msgid "Analytic_account" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_tree -msgid "Automatic Mass Reconcile" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_tree -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Automatic Mass Reconcile History" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile.method:account_mass_reconcile.account_mass_reconcile_method_form -#: view:account.mass.reconcile.method:account_mass_reconcile.account_mass_reconcile_method_tree -msgid "Automatic Mass Reconcile Method" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.model,name:account_mass_reconcile.model_res_company -msgid "Companies" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,company_id:0 -#: field:account.mass.reconcile.method,company_id:0 -#: field:mass.reconcile.history,company_id:0 -msgid "Company" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Configuration" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,create_uid:0 -#: field:account.mass.reconcile.method,create_uid:0 -#: field:mass.reconcile.history,create_uid:0 -#: field:mass.reconcile.simple.name,create_uid:0 -#: field:mass.reconcile.simple.partner,create_uid:0 -#: field:mass.reconcile.simple.reference,create_uid:0 -msgid "Created by" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,create_date:0 -#: field:account.mass.reconcile.method,create_date:0 -#: field:mass.reconcile.history,create_date:0 -#: field:mass.reconcile.simple.name,create_date:0 -#: field:mass.reconcile.simple.partner,create_date:0 -#: field:mass.reconcile.simple.reference,create_date:0 -msgid "Created on" -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Date" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,date_base_on:0 -#: field:mass.reconcile.advanced,date_base_on:0 -#: field:mass.reconcile.advanced.ref,date_base_on:0 -#: field:mass.reconcile.base,date_base_on:0 -#: field:mass.reconcile.options,date_base_on:0 -#: field:mass.reconcile.simple,date_base_on:0 -#: field:mass.reconcile.simple.name,date_base_on:0 -#: field:mass.reconcile.simple.partner,date_base_on:0 -#: field:mass.reconcile.simple.reference,date_base_on:0 -msgid "Date of reconciliation" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile,message_last_post:0 -msgid "Date of the last message posted on the record." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_tree -msgid "Display items partially reconciled on the last run" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_tree -msgid "Display items reconciled on the last run" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.actions.act_window,name:account_mass_reconcile.action_account_mass_reconcile -#: model:ir.ui.menu,name:account_mass_reconcile.menu_mass_reconcile -msgid "Mass Automatic Reconcile" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.actions.act_window,name:account_mass_reconcile.action_mass_reconcile_history -msgid "Mass Automatic Reconcile History" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile.py:329 -#, python-format -msgid "Error" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,filter:0 -#: field:mass.reconcile.advanced,filter:0 -#: field:mass.reconcile.advanced.ref,filter:0 -#: field:mass.reconcile.base,filter:0 -#: field:mass.reconcile.options,filter:0 -#: field:mass.reconcile.simple,filter:0 -#: field:mass.reconcile.simple.name,filter:0 -#: field:mass.reconcile.simple.partner,filter:0 -#: field:mass.reconcile.simple.reference,filter:0 -msgid "Filter" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_follower_ids:0 -msgid "Followers" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,income_exchange_account_id:0 -#: field:mass.reconcile.base,income_exchange_account_id:0 -#: field:mass.reconcile.options,income_exchange_account_id:0 -#: field:mass.reconcile.simple,income_exchange_account_id:0 -#: field:mass.reconcile.simple.name,income_exchange_account_id:0 -#: field:mass.reconcile.simple.partner,income_exchange_account_id:0 -#: field:mass.reconcile.simple.reference,income_exchange_account_id:0 -msgid "Gain ExchangeRate Account" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Go to partial reconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_tree -msgid "Go to partially reconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_form -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_tree -msgid "Go to reconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Go to unreconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Group By..." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -#: field:account.mass.reconcile,history_ids:0 -msgid "History" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.actions.act_window,name:account_mass_reconcile.act_mass_reconcile_to_history -msgid "History Details" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile,message_summary:0 -msgid "Holds the Chatter summary (number of messages, ...). This summary is directly in html format in order to be inserted in kanban views." -msgstr "" - -#. module: account_mass_reconcile -#: field:res.company,reconciliation_commit_every:0 -msgid "How often to commit when performing automaticreconciliation." -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,id:0 -#: field:account.mass.reconcile.method,id:0 -#: field:mass.reconcile.base,id:0 -#: field:mass.reconcile.history,id:0 -#: field:mass.reconcile.options,id:0 -#: field:mass.reconcile.simple,id:0 -#: field:mass.reconcile.simple.name,id:0 -#: field:mass.reconcile.simple.partner,id:0 -#: field:mass.reconcile.simple.reference,id:0 -msgid "ID" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile,message_unread:0 -msgid "If checked new messages require your attention." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Information" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_is_follower:0 -msgid "Is a Follower" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,journal_id:0 -#: field:mass.reconcile.advanced,journal_id:0 -#: field:mass.reconcile.advanced.ref,journal_id:0 -#: field:mass.reconcile.base,journal_id:0 -#: field:mass.reconcile.options,journal_id:0 -#: field:mass.reconcile.simple,journal_id:0 -#: field:mass.reconcile.simple.name,journal_id:0 -#: field:mass.reconcile.simple.partner,journal_id:0 -#: field:mass.reconcile.simple.reference,journal_id:0 -msgid "Journal" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_last_post:0 -msgid "Last Message Date" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,write_uid:0 -#: field:account.mass.reconcile.method,write_uid:0 -#: field:mass.reconcile.history,write_uid:0 -#: field:mass.reconcile.simple.name,write_uid:0 -#: field:mass.reconcile.simple.partner,write_uid:0 -#: field:mass.reconcile.simple.reference,write_uid:0 -msgid "Last Updated by" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,write_date:0 -#: field:account.mass.reconcile.method,write_date:0 -#: field:mass.reconcile.history,write_date:0 -#: field:mass.reconcile.simple.name,write_date:0 -#: field:mass.reconcile.simple.partner,write_date:0 -#: field:mass.reconcile.simple.reference,write_date:0 -msgid "Last Updated on" -msgstr "" - -#. module: account_mass_reconcile -#: help:res.company,reconciliation_commit_every:0 -msgid "Leave zero to commit only at the end of the process." -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,expense_exchange_account_id:0 -#: field:mass.reconcile.base,expense_exchange_account_id:0 -#: field:mass.reconcile.options,expense_exchange_account_id:0 -#: field:mass.reconcile.simple,expense_exchange_account_id:0 -#: field:mass.reconcile.simple.name,expense_exchange_account_id:0 -#: field:mass.reconcile.simple.partner,expense_exchange_account_id:0 -#: field:mass.reconcile.simple.reference,expense_exchange_account_id:0 -msgid "Loss ExchangeRate Account" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same name to be reconciled." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same partner to be reconciled." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same reference to be reconciled." -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_ids:0 -msgid "Messages" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile,message_ids:0 -msgid "Messages and communication history" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,reconcile_method:0 -msgid "Method" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,name:0 -msgid "Name" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.config.settings:account_mass_reconcile.view_account_config -msgid "Options" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile_history.py:108 -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_form -#: field:mass.reconcile.history,reconcile_ids:0 -#: field:mass.reconcile.history,reconcile_partial_ids:0 -#, python-format -msgid "Partial Reconciliations" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile.py:368 -#, python-format -msgid "Partial reconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: field:mass.reconcile.history,partial_line_ids:0 -msgid "Partially Reconciled Items" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Profile Information" -msgstr "" - -#. module: account_mass_reconcile -#: field:mass.reconcile.history,mass_reconcile_id:0 -msgid "Reconcile Profile" -msgstr "" - -#. module: account_mass_reconcile -#: field:mass.reconcile.history,reconcile_line_ids:0 -msgid "Reconciled Items" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.config.settings:account_mass_reconcile.view_account_config -msgid "Reconciliation" -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Reconciliation Profile" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile_history.py:105 -#: view:mass.reconcile.history:account_mass_reconcile.mass_reconcile_history_form -#, python-format -msgid "Reconciliations" -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Reconciliations of last 7 days" -msgstr "" - -#. module: account_mass_reconcile -#: field:mass.reconcile.advanced,partner_ids:0 -#: field:mass.reconcile.advanced.ref,partner_ids:0 -#: field:mass.reconcile.base,partner_ids:0 -#: field:mass.reconcile.simple,partner_ids:0 -#: field:mass.reconcile.simple.name,partner_ids:0 -#: field:mass.reconcile.simple.partner,partner_ids:0 -#: field:mass.reconcile.simple.reference,partner_ids:0 -msgid "Restrict on partners" -msgstr "" - -#. module: account_mass_reconcile -#: field:mass.reconcile.history,date:0 -msgid "Run date" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,sequence:0 -msgid "Sequence" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Simple. Amount and Name" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Simple. Amount and Partner" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Simple. Amount and Reference" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_tree -msgid "Start Auto Reconcilation" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:account_mass_reconcile.account_mass_reconcile_form -msgid "Start Auto Reconciliation" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_summary:0 -msgid "Summary" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,task_id:0 -msgid "Task" -msgstr "" - -#. module: account_mass_reconcile -#: help:account.mass.reconcile.method,sequence:0 -msgid "The sequence field is used to order the reconcile method" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile.py:330 -#, python-format -msgid "There is no history of reconciled items on the task: %s." -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Today" -msgstr "" - -#. module: account_mass_reconcile -#: view:mass.reconcile.history:account_mass_reconcile.view_mass_reconcile_history_search -msgid "Todays' Reconcilations" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,name:0 -msgid "Type" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile,message_unread:0 -msgid "Unread Messages" -msgstr "" - -#. module: account_mass_reconcile -#: code:addons/account_mass_reconcile/mass_reconcile.py:356 -#, python-format -msgid "Unreconciled items" -msgstr "" - -#. module: account_mass_reconcile -#: field:account.mass.reconcile.method,write_off:0 -#: field:mass.reconcile.advanced,write_off:0 -#: field:mass.reconcile.advanced.ref,write_off:0 -#: field:mass.reconcile.base,write_off:0 -#: field:mass.reconcile.options,write_off:0 -#: field:mass.reconcile.simple,write_off:0 -#: field:mass.reconcile.simple.name,write_off:0 -#: field:mass.reconcile.simple.partner,write_off:0 -#: field:mass.reconcile.simple.reference,write_off:0 -msgid "Write off allowed" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.model,name:account_mass_reconcile.model_account_mass_reconcile -msgid "account mass reconcile" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.config.settings:account_mass_reconcile.view_account_config -msgid "eInvoicing & Payments" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.model,name:account_mass_reconcile.model_account_mass_reconcile_method -msgid "reconcile method for account_mass_reconcile" -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:0 -msgid "Match multiple debit vs multiple credit entries. Allow partial reconciliation. The lines should have the partner, the credit entry ref. is matched vs the debit entry ref. or name." -msgstr "" - -#. module: account_mass_reconcile -#: view:account.mass.reconcile:0 -msgid "Advanced. Partner and Ref" -msgstr "" - -#. module: account_mass_reconcile -#: model:ir.model,name:account_mass_reconcile.model_mass_reconcile_advanced -msgid "mass.reconcile.advanced" -msgstr "mass.reconcile.advanced" - -#. module: account_mass_reconcile -#: model:ir.model,name:account_mass_reconcile.model_mass_reconcile_advanced_ref -msgid "mass.reconcile.advanced.ref" -msgstr "mass.reconcile.advanced.ref" diff --git a/account_mass_reconcile/models/__init__.py b/account_mass_reconcile/models/__init__.py index ca86d6b4..9fbeaa79 100755 --- a/account_mass_reconcile/models/__init__.py +++ b/account_mass_reconcile/models/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from . import mass_reconcile from . import base_reconciliation from . import base_advanced_reconciliation diff --git a/account_mass_reconcile/models/advanced_reconciliation.py b/account_mass_reconcile/models/advanced_reconciliation.py index df3fd7b3..acfa6f81 100644 --- a/account_mass_reconcile/models/advanced_reconciliation.py +++ b/account_mass_reconcile/models/advanced_reconciliation.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api +from odoo import models class MassReconcileAdvancedRef(models.TransientModel): @@ -11,8 +10,8 @@ class MassReconcileAdvancedRef(models.TransientModel): _name = 'mass.reconcile.advanced.ref' _inherit = 'mass.reconcile.advanced' - @api.multi - def _skip_line(self, move_line): + @staticmethod + def _skip_line(move_line): """ When True is returned on some conditions, the credit move line will be skipped for reconciliation. Can be inherited to @@ -20,8 +19,8 @@ class MassReconcileAdvancedRef(models.TransientModel): """ return not (move_line.get('ref') and move_line.get('partner_id')) - @api.multi - def _matchers(self, move_line): + @staticmethod + def _matchers(move_line): """ Return the values used as matchers to find the opposite lines @@ -61,8 +60,8 @@ class MassReconcileAdvancedRef(models.TransientModel): return (('partner_id', move_line['partner_id']), ('ref', move_line['ref'].lower().strip())) - @api.multi - def _opposite_matchers(self, move_line): + @staticmethod + def _opposite_matchers(move_line): """ Return the values of the opposite line used as matchers so the line is matched diff --git a/account_mass_reconcile/models/base_advanced_reconciliation.py b/account_mass_reconcile/models/base_advanced_reconciliation.py index 5014d754..3b4fba16 100644 --- a/account_mass_reconcile/models/base_advanced_reconciliation.py +++ b/account_mass_reconcile/models/base_advanced_reconciliation.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging +from itertools import product from odoo import models, api -from itertools import product from odoo.tools.translate import _ _logger = logging.getLogger(__name__) @@ -16,12 +15,11 @@ class MassReconcileAdvanced(models.AbstractModel): _name = 'mass.reconcile.advanced' _inherit = 'mass.reconcile.base' - @api.multi def _query_debit(self): """Select all move (debit>0) as candidate. """ - select = self._select() - sql_from = self._from() - where, params = self._where() + select = self._select_query() + sql_from = self._from_query() + where, params = self._where_query() where += " AND account_move_line.debit > 0 " where2, params2 = self._get_filter() query = ' '.join((select, sql_from, where, where2)) @@ -30,17 +28,17 @@ class MassReconcileAdvanced(models.AbstractModel): def _query_credit(self): """Select all move (credit>0) as candidate. """ - select = self._select() - sql_from = self._from() - where, params = self._where() + select = self._select_query() + sql_from = self._from_query() + where, params = self._where_query() where += " AND account_move_line.credit > 0 " where2, params2 = self._get_filter() query = ' '.join((select, sql_from, where, where2)) self.env.cr.execute(query, params + params2) return self.env.cr.dictfetchall() - @api.multi - def _matchers(self, move_line): + @staticmethod + def _matchers(move_line): """ Return the values used as matchers to find the opposite lines @@ -79,8 +77,8 @@ class MassReconcileAdvanced(models.AbstractModel): """ raise NotImplementedError - @api.multi - def _opposite_matchers(self, move_line): + @staticmethod + def _opposite_matchers(move_line): """ Return the values of the opposite line used as matchers so the line is matched @@ -136,15 +134,15 @@ class MassReconcileAdvanced(models.AbstractModel): return True return False - @staticmethod - def _compare_matcher_values(key, values, opposite_values): + @classmethod + def _compare_matcher_values(cls, key, values, opposite_values): """ Compare every values from a matcher vs an opposite matcher and return True if it matches """ for value, ovalue in product(values, opposite_values): # we do not need to compare all values, if one matches # we are done - if MassReconcileAdvanced._compare_values(key, value, ovalue): + if cls._compare_values(key, value, ovalue): return True return False @@ -165,7 +163,6 @@ class MassReconcileAdvanced(models.AbstractModel): return MassReconcileAdvanced._compare_matcher_values(mkey, mvalue, omvalue) - @api.multi def _compare_opposite(self, move_line, opposite_move_line, matchers): """ Iterate over the matchers of the move lines vs opposite move lines and if they all match, return True. @@ -191,7 +188,6 @@ class MassReconcileAdvanced(models.AbstractModel): return True - @api.multi def _search_opposites(self, move_line, opposite_move_lines): """Search the opposite move lines for a move line @@ -210,7 +206,6 @@ class MassReconcileAdvanced(models.AbstractModel): result = self._rec_auto_lines_advanced(credit_lines, debit_lines) return result - @api.multi def _skip_line(self, move_line): """ When True is returned on some conditions, the credit move line diff --git a/account_mass_reconcile/models/base_reconciliation.py b/account_mass_reconcile/models/base_reconciliation.py index a1f796bc..fe394f1c 100644 --- a/account_mass_reconcile/models/base_reconciliation.py +++ b/account_mass_reconcile/models/base_reconciliation.py @@ -1,19 +1,17 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, models, api, fields -from odoo.tools.safe_eval import safe_eval +from functools import reduce from operator import itemgetter +from odoo import _, api, fields, models +from odoo.tools.safe_eval import safe_eval + class MassReconcileBase(models.AbstractModel): - """Abstract Model for reconciliation methods""" - _name = 'mass.reconcile.base' - _inherit = 'mass.reconcile.options' account_id = fields.Many2one( @@ -36,7 +34,6 @@ class MassReconcileBase(models.AbstractModel): self.ensure_one() return self._action_rec() - @api.multi def _action_rec(self): """ Must be inherited to implement the reconciliation @@ -44,7 +41,8 @@ class MassReconcileBase(models.AbstractModel): """ raise NotImplementedError - def _base_columns(self): + @staticmethod + def _base_columns(): """ Mandatory columns for move lines queries An extra column aliased as ``key`` should be defined in each query.""" @@ -58,19 +56,19 @@ class MassReconcileBase(models.AbstractModel): 'partner_id', 'account_id', 'reconciled', - 'move_id') - return ["account_move_line.%s" % col for col in aml_cols] + 'move_id', + ) + return ["account_move_line.{}".format(col) for col in aml_cols] - @api.multi - def _select(self, *args, **kwargs): + def _select_query(self, *args, **kwargs): return "SELECT %s" % ', '.join(self._base_columns()) - @api.multi - def _from(self, *args, **kwargs): + def _from_query(self, *args, **kwargs): return ("FROM account_move_line ") @api.multi - def _where(self, *args, **kwargs): + def _where_query(self, *args, **kwargs): + self.ensure_one() where = ("WHERE account_move_line.account_id = %s " "AND NOT account_move_line.reconciled") # it would be great to use dict for params @@ -85,12 +83,13 @@ class MassReconcileBase(models.AbstractModel): @api.multi def _get_filter(self): + self.ensure_one() ml_obj = self.env['account.move.line'] where = '' params = [] - if self.filter: + if self._filter: dummy, where, params = ml_obj._where_calc( - safe_eval(self.filter)).get_sql() + safe_eval(self._filter)).get_sql() if where: where = " AND %s" % where return where, params @@ -104,7 +103,7 @@ class MassReconcileBase(models.AbstractModel): lambda line, memo: dict((key, value + memo[key]) for key, value - in line.iteritems() + in line.items() if key in keys), lines) debit, credit = sums['debit'], sums['credit'] writeoff_amount = round(debit - credit, precision) @@ -164,7 +163,7 @@ class MassReconcileBase(models.AbstractModel): line_rs.reconcile( writeoff_acc_id=writeoff_account, writeoff_journal_id=self.journal_id - ) + ) return True, True elif allow_partial: # We need to give a writeoff_acc_id @@ -181,6 +180,6 @@ class MassReconcileBase(models.AbstractModel): line_rs.reconcile( writeoff_acc_id=writeoff_account, writeoff_journal_id=self.journal_id - ) + ) return True, False return False, False diff --git a/account_mass_reconcile/models/mass_reconcile.py b/account_mass_reconcile/models/mass_reconcile.py index 9b5eaebe..894dc775 100644 --- a/account_mass_reconcile/models/mass_reconcile.py +++ b/account_mass_reconcile/models/mass_reconcile.py @@ -1,14 +1,14 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from datetime import datetime +import logging + from odoo import models, api, fields, _ from odoo.exceptions import Warning as UserError from odoo import sql_db -import logging _logger = logging.getLogger(__name__) @@ -20,7 +20,6 @@ class MassReconcileOptions(models.AbstractModel): This allows decoupling of the methods and the wizards and allows to launch the wizards alone """ - _name = 'mass.reconcile.options' @api.model @@ -30,24 +29,39 @@ class MassReconcileOptions(models.AbstractModel): ('actual', 'Today'), ] - write_off = fields.Float('Write off allowed', default=0.) - account_lost_id = fields.Many2one('account.account', - string="Account Lost") - account_profit_id = fields.Many2one('account.account', - string="Account Profit") - journal_id = fields.Many2one('account.journal', - string="Journal") - date_base_on = fields.Selection('_get_rec_base_date', - required=True, - string='Date of reconciliation', - default='newest') - filter = fields.Char(string='Filter') - income_exchange_account_id = fields.Many2one('account.account', - string='Gain Exchange ' - 'Rate Account') - expense_exchange_account_id = fields.Many2one('account.account', - string='Loss Exchange ' - 'Rate Account') + write_off = fields.Float( + 'Write off allowed', + default=0., + ) + account_lost_id = fields.Many2one( + 'account.account', + string="Account Lost", + ) + account_profit_id = fields.Many2one( + 'account.account', + string="Account Profit", + ) + journal_id = fields.Many2one( + 'account.journal', + string="Journal", + ) + date_base_on = fields.Selection( + '_get_rec_base_date', + required=True, + string='Date of reconciliation', + default='newest', + ) + _filter = fields.Char( + string='Filter', + ) + income_exchange_account_id = fields.Many2one( + 'account.account', + string='Gain Exchange Rate Account', + ) + expense_exchange_account_id = fields.Many2one( + 'account.account', + string='Loss Exchange Rate Account', + ) class AccountMassReconcileMethod(models.Model): @@ -56,8 +70,8 @@ class AccountMassReconcileMethod(models.Model): _inherit = 'mass.reconcile.options' _order = 'sequence' - @api.model - def _get_all_rec_method(self): + @staticmethod + def _get_reconcilation_methods(): return [ ('mass.reconcile.simple.name', 'Simple. Amount and Name'), ('mass.reconcile.simple.partner', 'Simple. Amount and Partner'), @@ -67,32 +81,36 @@ class AccountMassReconcileMethod(models.Model): 'Advanced. Partner and Ref.'), ] - @api.model - def _get_rec_method(self): - return self._get_all_rec_method() + def _selection_name(self): + return self._get_reconcilation_methods() - name = fields.Selection('_get_rec_method', string='Type', required=True) - sequence = fields.Integer(string='Sequence', - default=1, - required=True, - help="The sequence field is used to order " - "the reconcile method" - ) - task_id = fields.Many2one('account.mass.reconcile', - string='Task', - required=True, - ondelete='cascade' - ) - company_id = fields.Many2one('res.company', - string='Company', - related="task_id.company_id", - store=True, - readonly=True - ) + name = fields.Selection( + '_selection_name', + string='Type', + required=True, + ) + sequence = fields.Integer( + string='Sequence', + default=1, + required=True, + help="The sequence field is used to order the reconcile method", + ) + task_id = fields.Many2one( + 'account.mass.reconcile', + string='Task', + required=True, + ondelete='cascade', + ) + company_id = fields.Many2one( + 'res.company', + string='Company', + related="task_id.company_id", + store=True, + readonly=True, + ) class AccountMassReconcile(models.Model): - _name = 'account.mass.reconcile' _inherit = ['mail.thread'] _description = 'account mass reconcile' @@ -120,31 +138,42 @@ class AccountMassReconcile(models.Model): ) rec.last_history = last_history_rs or False - name = fields.Char(string='Name', required=True) - account = fields.Many2one('account.account', - string='Account', - required=True, - ) - reconcile_method = fields.One2many('account.mass.reconcile.method', - 'task_id', - string='Method' - ) - unreconciled_count = fields.Integer(string='Unreconciled Items', - compute='_get_total_unrec' - ) - history_ids = fields.One2many('mass.reconcile.history', - 'mass_reconcile_id', - string='History', - readonly=True - ) - last_history = fields.Many2one('mass.reconcile.history', - string='Last history', readonly=True, - compute='_last_history', - ) - company_id = fields.Many2one('res.company', string='Company') + name = fields.Char( + string='Name', + required=True, + ) + account = fields.Many2one( + 'account.account', + string='Account', + required=True, + ) + reconcile_method = fields.One2many( + 'account.mass.reconcile.method', + 'task_id', + string='Method', + ) + unreconciled_count = fields.Integer( + string='Unreconciled Items', + compute='_get_total_unrec', + ) + history_ids = fields.One2many( + 'mass.reconcile.history', + 'mass_reconcile_id', + string='History', + readonly=True, + ) + last_history = fields.Many2one( + 'mass.reconcile.history', + string='Last history', readonly=True, + compute='_last_history', + ) + company_id = fields.Many2one( + 'res.company', + string='Company', + ) - @api.model - def _prepare_run_transient(self, rec_method): + @staticmethod + def _prepare_run_transient(rec_method): return {'account_id': rec_method.task_id.account.id, 'write_off': rec_method.write_off, 'account_lost_id': (rec_method.account_lost_id.id), @@ -155,7 +184,7 @@ class AccountMassReconcile(models.Model): (rec_method.income_exchange_account_id.id), 'journal_id': (rec_method.journal_id.id), 'date_base_on': rec_method.date_base_on, - 'filter': rec_method.filter} + '_filter': rec_method._filter} @api.multi def run_reconcile(self): @@ -216,10 +245,10 @@ class AccountMassReconcile(models.Model): # the cron will just loop on this reconcile task. _logger.exception( "The reconcile task %s had an exception: %s", - rec.name, e.message + rec.name, str(e) ) message = _("There was an error during reconciliation : %s") \ - % e.message + % str(e) rec.message_post(body=message) self.env['mass.reconcile.history'].create( { @@ -235,7 +264,6 @@ class AccountMassReconcile(models.Model): return True - @api.multi def _no_history(self): """ Raise an `orm.except_orm` error, supposed to be called when there is no history on the reconciliation @@ -246,8 +274,8 @@ class AccountMassReconcile(models.Model): 'items on the task: %s.') % self.name ) - @api.model - def _open_move_line_list(self, move_line_ids, name): + @staticmethod + def _open_move_line_list(move_line_ids, name): return { 'name': name, 'view_mode': 'tree,form', @@ -257,7 +285,7 @@ class AccountMassReconcile(models.Model): 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', - 'domain': unicode([('id', 'in', move_line_ids)]), + 'domain': [('id', 'in', move_line_ids)], } @api.multi @@ -271,7 +299,6 @@ class AccountMassReconcile(models.Model): name = _('Unreconciled items') return self._open_move_line_list(lines.ids or [], name) - @api.multi def last_history_reconcile(self): """ Get the last history record for this reconciliation profile and return the action which opens move lines reconciled diff --git a/account_mass_reconcile/models/mass_reconcile_history.py b/account_mass_reconcile/models/mass_reconcile_history.py index 4f4b0729..d6d9898e 100644 --- a/account_mass_reconcile/models/mass_reconcile_history.py +++ b/account_mass_reconcile/models/mass_reconcile_history.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) +# Copyright 2012-2016 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, api, fields, _ @@ -7,8 +6,9 @@ from odoo import models, api, fields, _ class MassReconcileHistory(models.Model): """ Store an history of the runs per profile - Each history stores the list of reconciliations done""" + Each history stores the list of reconciliations done + """ _name = 'mass.reconcile.history' _rec_name = 'mass_reconcile_id' _order = 'date DESC' @@ -24,27 +24,31 @@ class MassReconcileHistory(models.Model): mass_reconcile_id = fields.Many2one( 'account.mass.reconcile', string='Reconcile Profile', - readonly=True + readonly=True, + ) + date = fields.Datetime( + string='Run date', + readonly=True, + required=True, ) - date = fields.Datetime(string='Run date', readonly=True, required=True) reconcile_ids = fields.Many2many( comodel_name='account.full.reconcile', relation='account_full_reconcile_history_rel', string='Full Reconciliations', - readonly=True + readonly=True, ) reconcile_line_ids = fields.Many2many( comodel_name='account.move.line', relation='account_move_line_history_rel', string='Reconciled Items', - compute='_get_reconcile_line_ids' + compute='_get_reconcile_line_ids', ) company_id = fields.Many2one( 'res.company', string='Company', store=True, readonly=True, - related='mass_reconcile_id.company_id' + related='mass_reconcile_id.company_id', ) @api.multi @@ -66,7 +70,7 @@ class MassReconcileHistory(models.Model): 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', - 'domain': unicode([('id', 'in', move_line_ids)]), + 'domain': [('id', 'in', move_line_ids)], } @api.multi diff --git a/account_mass_reconcile/models/res_config.py b/account_mass_reconcile/models/res_config.py index a584217b..aa6f20c4 100644 --- a/account_mass_reconcile/models/res_config.py +++ b/account_mass_reconcile/models/res_config.py @@ -1,18 +1,16 @@ -# -*- coding: utf-8 -*- -# © 2014-2016 Camptocamp SA (Leonardo Pistone, Damien Crier, Matthieu Dietrich) +# Copyright 2014-2016 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, fields class AccountConfigSettings(models.TransientModel): - _inherit = 'account.config.settings' + _inherit = 'res.config.settings' reconciliation_commit_every = fields.Integer( related="company_id.reconciliation_commit_every", - string="How often to commit when performing automatic " - "reconciliation.", - help="Leave zero to commit only at the end of the process." + string="How often to commit when performing automatic reconciliation.", + help="Leave zero to commit only at the end of the process.", ) @@ -20,7 +18,6 @@ class Company(models.Model): _inherit = "res.company" reconciliation_commit_every = fields.Integer( - string="How often to commit when performing automatic " - "reconciliation.", - help="Leave zero to commit only at the end of the process." + string="How often to commit when performing automatic reconciliation.", + help="Leave zero to commit only at the end of the process.", ) diff --git a/account_mass_reconcile/models/simple_reconciliation.py b/account_mass_reconcile/models/simple_reconciliation.py index b3c3fe62..de521e22 100644 --- a/account_mass_reconcile/models/simple_reconciliation.py +++ b/account_mass_reconcile/models/simple_reconciliation.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# © 2012-2016 Camptocamp SA (Guewen Baconnier, Damien Crier, Matthieu Dietrich) -# © 2010 Sébastien Beau +# Copyright 2012-2016 Camptocamp SA +# Copyright 2010 Sébastien Beau # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, api @@ -21,7 +20,7 @@ class MassReconcileSimple(models.AbstractModel): count = 0 res = [] while (count < len(lines)): - for i in xrange(count + 1, len(lines)): + for i in range(count + 1, len(lines)): if lines[count][self._key_field] != lines[i][self._key_field]: break check = False @@ -46,22 +45,20 @@ class MassReconcileSimple(models.AbstractModel): count += 1 return res - @api.multi def _simple_order(self, *args, **kwargs): return "ORDER BY account_move_line.%s" % self._key_field - @api.multi def _action_rec(self): """Match only 2 move lines, do not allow partial reconcile""" - select = self._select() + select = self._select_query() select += ", account_move_line.%s " % self._key_field - where, params = self._where() + where, params = self._where_query() where += " AND account_move_line.%s IS NOT NULL " % self._key_field where2, params2 = self._get_filter() query = ' '.join(( select, - self._from(), + self._from_query(), where, where2, self._simple_order())) diff --git a/account_mass_reconcile/security/ir_rule.xml b/account_mass_reconcile/security/ir_rule.xml index 5ad4cc08..cbb2fc94 100644 --- a/account_mass_reconcile/security/ir_rule.xml +++ b/account_mass_reconcile/security/ir_rule.xml @@ -1,25 +1,25 @@ - - - - Mass reconcile multi-company - - - ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] - + - - Mass reconcile history multi-company - - - ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] - + + Mass reconcile multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + - - Mass reconcile method multi-company - - - ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] - - - + + Mass reconcile history multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + + Mass reconcile method multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + diff --git a/account_mass_reconcile/tests/__init__.py b/account_mass_reconcile/tests/__init__.py index 9f9b96e4..fe1df9fe 100644 --- a/account_mass_reconcile/tests/__init__.py +++ b/account_mass_reconcile/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Damien Crier) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/account_mass_reconcile/tests/test_onchange_company.py b/account_mass_reconcile/tests/test_onchange_company.py index 873fadb6..202e2429 100644 --- a/account_mass_reconcile/tests/test_onchange_company.py +++ b/account_mass_reconcile/tests/test_onchange_company.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Damien Crier) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -7,20 +6,21 @@ from odoo import tools from odoo.modules import get_module_resource -class TestOnChange(common.TransactionCase): +class TestOnChange(common.SavepointCase): - def setUp(self): - super(TestOnChange, self).setUp() - tools.convert_file(self.cr, 'account', + @classmethod + def setUpClass(cls): + super(TestOnChange, cls).setUpClass() + tools.convert_file(cls.cr, 'account', get_module_resource('account', 'test', 'account_minimal_test.xml'), {}, 'init', False, 'test') - acc_setting = self.env['account.config.settings'] - self.acc_setting_obj = acc_setting.create({}) - self.company_obj = self.env['res.company'] + acc_setting = cls.env['res.config.settings'] + cls.acc_setting_obj = acc_setting.create({}) + cls.company_obj = cls.env['res.company'] # analytic defaults account creation - self.main_company = self.env.ref('base.main_company') - self.sec_company = self.company_obj.create( + cls.main_company = cls.env.ref('base.main_company') + cls.sec_company = cls.company_obj.create( { 'name': 'Second company', 'reconciliation_commit_every': 80 diff --git a/account_mass_reconcile/tests/test_reconcile.py b/account_mass_reconcile/tests/test_reconcile.py index b0f4bb83..83ac5fc1 100644 --- a/account_mass_reconcile/tests/test_reconcile.py +++ b/account_mass_reconcile/tests/test_reconcile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Damien Crier) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -7,45 +6,37 @@ from odoo import fields, exceptions, tools from odoo.modules import get_module_resource -class TestReconcile(common.TransactionCase): +class TestReconcile(common.SavepointCase): - def setUp(self): - super(TestReconcile, self).setUp() - tools.convert_file(self.cr, 'account', + @classmethod + def setUpClass(cls): + super(TestReconcile, cls).setUpClass() + tools.convert_file(cls.cr, 'account', get_module_resource('account', 'test', 'account_minimal_test.xml'), {}, 'init', False, 'test') - self.rec_history_obj = self.env['mass.reconcile.history'] - self.mass_rec_obj = self.env['account.mass.reconcile'] - self.mass_rec_method_obj = ( - self.env['account.mass.reconcile.method'] + cls.rec_history_obj = cls.env['mass.reconcile.history'] + cls.mass_rec_obj = cls.env['account.mass.reconcile'] + cls.mass_rec_method_obj = ( + cls.env['account.mass.reconcile.method'] ) - self.mass_rec = self.mass_rec_obj.create( - { - 'name': 'AER2', - 'account': self.ref('account.a_salary_expense'), - } - ) - self.mass_rec_method = self.mass_rec_method_obj.create( - { - 'name': 'mass.reconcile.simple.name', - 'sequence': '10', - 'task_id': self.mass_rec.id, - } - ) - self.mass_rec_no_history = self.mass_rec_obj.create( - { - 'name': 'AER3', - 'account': self.ref('account.a_salary_expense'), - - } - ) - self.rec_history = self.rec_history_obj.create( - { - 'mass_reconcile_id': self.mass_rec.id, - 'date': fields.Datetime.now(), - } - ) + cls.mass_rec = cls.mass_rec_obj.create({ + 'name': 'AER2', + 'account': cls.env.ref('account.a_salary_expense').id, + }) + cls.mass_rec_method = cls.mass_rec_method_obj.create({ + 'name': 'mass.reconcile.simple.name', + 'sequence': '10', + 'task_id': cls.mass_rec.id, + }) + cls.mass_rec_no_history = cls.mass_rec_obj.create({ + 'name': 'AER3', + 'account': cls.env.ref('account.a_salary_expense').id, + }) + cls.rec_history = cls.rec_history_obj.create({ + 'mass_reconcile_id': cls.mass_rec.id, + 'date': fields.Datetime.now(), + }) def test_last_history(self): mass_rec_last_hist = self.mass_rec.last_history @@ -61,7 +52,7 @@ class TestReconcile(common.TransactionCase): def test_open_unreconcile(self): res = self.mass_rec.open_unreconcile() - self.assertEqual(unicode([('id', 'in', [])]), res.get('domain', [])) + self.assertEqual([('id', 'in', [])], res.get('domain', [])) def test_prepare_run_transient(self): res = self.mass_rec._prepare_run_transient(self.mass_rec_method) diff --git a/account_mass_reconcile/tests/test_reconcile_history.py b/account_mass_reconcile/tests/test_reconcile_history.py index f557a0d7..b6ec4323 100644 --- a/account_mass_reconcile/tests/test_reconcile_history.py +++ b/account_mass_reconcile/tests/test_reconcile_history.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Damien Crier) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -7,36 +6,37 @@ from odoo import fields, tools from odoo.modules import get_module_resource -class TestReconcileHistory(common.TransactionCase): +class TestReconcileHistory(common.SavepointCase): - def setUp(self): - super(TestReconcileHistory, self).setUp() - tools.convert_file(self.cr, 'account', + @classmethod + def setUpClass(cls): + super(TestReconcileHistory, cls).setUpClass() + tools.convert_file(cls.cr, 'account', get_module_resource('account', 'test', 'account_minimal_test.xml'), {}, 'init', False, 'test') - self.rec_history_obj = self.env['mass.reconcile.history'] - self.mass_rec_obj = self.env['account.mass.reconcile'] - self.mass_rec = self.mass_rec_obj.create( + cls.rec_history_obj = cls.env['mass.reconcile.history'] + cls.mass_rec_obj = cls.env['account.mass.reconcile'] + cls.mass_rec = cls.mass_rec_obj.create( { 'name': 'AER1', - 'account': self.ref('account.a_expense'), + 'account': cls.env.ref('account.a_expense').id, } ) - self.rec_history = self.rec_history_obj.create( + cls.rec_history = cls.rec_history_obj.create( { - 'mass_reconcile_id': self.mass_rec.id, + 'mass_reconcile_id': cls.mass_rec.id, 'date': fields.Datetime.now(), } ) def test_open_full_empty(self): res = self.rec_history._open_move_lines() - self.assertEqual(unicode([('id', 'in', [])]), res.get( + self.assertEqual([('id', 'in', [])], res.get( 'domain', [])) def test_open_full_empty_from_method(self): res = self.rec_history.open_reconcile() - self.assertEqual(unicode([('id', 'in', [])]), res.get( + self.assertEqual([('id', 'in', [])], res.get( 'domain', [])) diff --git a/account_mass_reconcile/tests/test_scenario_reconcile.py b/account_mass_reconcile/tests/test_scenario_reconcile.py index ff9f368f..9bbf4c7e 100644 --- a/account_mass_reconcile/tests/test_scenario_reconcile.py +++ b/account_mass_reconcile/tests/test_scenario_reconcile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2014-2016 Camptocamp SA (Damien Crier) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -7,40 +6,42 @@ from odoo import fields, tools from odoo.modules import get_module_resource -class TestScenarioReconcile(common.TransactionCase): +class TestScenarioReconcile(common.SavepointCase): - def setUp(self): - super(TestScenarioReconcile, self).setUp() - tools.convert_file(self.cr, 'account', + @classmethod + def setUpClass(cls): + super(TestScenarioReconcile, cls).setUpClass() + tools.convert_file(cls.cr, 'account', get_module_resource('account', 'test', 'account_minimal_test.xml'), {}, 'init', False, 'test') - self.rec_history_obj = self.env['mass.reconcile.history'] - self.mass_rec_obj = self.env['account.mass.reconcile'] - self.invoice_obj = self.env['account.invoice'] - self.bk_stmt_obj = self.env['account.bank.statement'] - self.bk_stmt_line_obj = self.env['account.bank.statement.line'] - self.acc_move_line_obj = self.env['account.move.line'] - self.mass_rec_method_obj = ( - self.env['account.mass.reconcile.method'] + cls.rec_history_obj = cls.env['mass.reconcile.history'] + cls.mass_rec_obj = cls.env['account.mass.reconcile'] + cls.invoice_obj = cls.env['account.invoice'] + cls.bk_stmt_obj = cls.env['account.bank.statement'] + cls.bk_stmt_line_obj = cls.env['account.bank.statement.line'] + cls.acc_move_line_obj = cls.env['account.move.line'] + cls.mass_rec_method_obj = ( + cls.env['account.mass.reconcile.method'] ) - self.account_fx_income_id = self.ref("account.income_fx_income") - self.account_fx_expense_id = self.ref("account.income_fx_expense") - self.acs_model = self.env['account.config.settings'] + cls.account_fx_income_id = cls.env.ref("account.income_fx_income").id + cls.account_fx_expense_id = cls.env.ref("account.income_fx_expense").id + cls.acs_model = cls.env['res.config.settings'] - acs_ids = self.acs_model.search( - [('company_id', '=', self.ref("base.main_company"))] + acs_ids = cls.acs_model.search( + [('company_id', '=', cls.env.ref("base.main_company").id)] ) - values = {'group_multi_currency': True, - 'currency_id': self.ref('base.EUR')} + values = { + 'group_multi_currency': True, + } if acs_ids: acs_ids.write(values) else: - default_vals = self.acs_model.default_get([]) + default_vals = cls.acs_model.default_get([]) default_vals.update(values) - acs_ids = self.acs_model.create(default_vals) + acs_ids = cls.acs_model.create(default_vals) def test_scenario_reconcile(self): # create invoice @@ -80,8 +81,7 @@ class TestScenarioReconcile(common.TransactionCase): 'partner_id': self.ref('base.res_partner_12'), 'name': invoice.number, 'ref': invoice.number, - } - ) + }) ] } ) @@ -119,9 +119,8 @@ class TestScenarioReconcile(common.TransactionCase): 'account': self.ref('account.a_recv'), 'reconcile_method': [ (0, 0, { - 'name': 'mass.reconcile.simple.partner', - } - ) + 'name': 'mass.reconcile.simple.partner', + }) ] } ) @@ -155,8 +154,7 @@ class TestScenarioReconcile(common.TransactionCase): 'price_unit': 1000.0, 'quantity': 1.0, 'product_id': self.ref('product.product_product_3'), - } - ) + }) ] } ) @@ -179,8 +177,7 @@ class TestScenarioReconcile(common.TransactionCase): 'partner_id': self.ref('base.res_partner_12'), 'name': invoice.number, 'ref': invoice.number, - } - ) + }) ] } ) @@ -217,9 +214,8 @@ class TestScenarioReconcile(common.TransactionCase): 'account': self.ref('account.a_recv'), 'reconcile_method': [ (0, 0, { - 'name': 'mass.reconcile.simple.partner', - } - ) + 'name': 'mass.reconcile.simple.partner', + }) ] } ) diff --git a/account_mass_reconcile/views/mass_reconcile.xml b/account_mass_reconcile/views/mass_reconcile.xml index c0692d69..cb404bb2 100644 --- a/account_mass_reconcile/views/mass_reconcile.xml +++ b/account_mass_reconcile/views/mass_reconcile.xml @@ -141,15 +141,14 @@ The lines should have the partner, the credit entry ref. is matched vs the debit Do Automatic Reconciliations - + + 3 hours -1 - - - - + + model.run_scheduler() diff --git a/account_mass_reconcile/views/res_config_view.xml b/account_mass_reconcile/views/res_config_view.xml index 26620311..d1e8821e 100644 --- a/account_mass_reconcile/views/res_config_view.xml +++ b/account_mass_reconcile/views/res_config_view.xml @@ -1,22 +1,30 @@ + account settings - account.config.settings - + res.config.settings + - - - -