From 65cfe5d961bc6e5721336dad6716bd491db4c49d Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Tue, 31 Jan 2012 13:53:19 +0100 Subject: [PATCH 01/58] [ADD] port account_reversal from v6.0 and add features : to_be_reversed flag and reversal_id many2one (lp:c2c-addons/6.1 rev 5609) --- account_reversal/__init__.py | 25 +++ account_reversal/__openerp__.py | 47 +++++ account_reversal/account_reversal.py | 124 +++++++++++++ account_reversal/account_view.xml | 62 +++++++ account_reversal/i18n/account_reversal.pot | 132 ++++++++++++++ account_reversal/i18n/ca.po | 127 ++++++++++++++ account_reversal/i18n/es.po | 129 ++++++++++++++ account_reversal/i18n/fr.po | 165 ++++++++++++++++++ account_reversal/wizard/__init__.py | 1 + .../wizard/account_move_reverse.py | 99 +++++++++++ .../wizard/account_move_reverse_view.xml | 46 +++++ 11 files changed, 957 insertions(+) create mode 100644 account_reversal/__init__.py create mode 100644 account_reversal/__openerp__.py create mode 100644 account_reversal/account_reversal.py create mode 100644 account_reversal/account_view.xml create mode 100644 account_reversal/i18n/account_reversal.pot create mode 100644 account_reversal/i18n/ca.po create mode 100644 account_reversal/i18n/es.po create mode 100644 account_reversal/i18n/fr.po create mode 100644 account_reversal/wizard/__init__.py create mode 100644 account_reversal/wizard/account_move_reverse.py create mode 100644 account_reversal/wizard/account_move_reverse_view.xml diff --git a/account_reversal/__init__.py b/account_reversal/__init__.py new file mode 100644 index 000000000..6183b6b93 --- /dev/null +++ b/account_reversal/__init__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account reversal module for OpenERP +# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + + +import account_reversal +import wizard diff --git a/account_reversal/__openerp__.py b/account_reversal/__openerp__.py new file mode 100644 index 000000000..e2ebd06c3 --- /dev/null +++ b/account_reversal/__openerp__.py @@ -0,0 +1,47 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account reversal module for OpenERP +# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved +# @author Alexis de Lattre +# +# 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': 'Account Reversal', + 'version': '0.2', + 'category': 'Generic Modules/Accounting', + 'license': 'AGPL-3', + 'description': """This module adds an action "Reversal" on account moves, to allow the accountant to create reversal account moves in 2 clicks. +Also add on account entries : + - a checkbox and filter "to be reversed" + - a link between an entry and its reversal entry + +Module developped by Alexis de Lattre during the Akretion-Camptocamp code sprint of June 2011. + +""", + 'author': 'Akretion', + 'website': 'http://www.akretion.com/', + 'depends': ['account'], + 'init_xml': [], + 'update_xml': ['account_view.xml', + 'wizard/account_move_reverse_view.xml'], + 'demo_xml': [], + 'installable': True, + 'active': False, +} + diff --git a/account_reversal/account_reversal.py b/account_reversal/account_reversal.py new file mode 100644 index 000000000..667f7b2e4 --- /dev/null +++ b/account_reversal/account_reversal.py @@ -0,0 +1,124 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Account reversal module for OpenERP +# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved +# @author Alexis de Lattre +# with the kind advice of Nicolas Bessi from Camptocamp +# Copyright (C) 2012 Camptocamp SA (http://www.camptocamp.com). All Rights Reserved +# @author Guewen Baconnier +# +# 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 osv import fields, osv +from tools.translate import _ + +class account_move(osv.osv): + _inherit = "account.move" + + _columns = { + 'to_be_reversed': fields.boolean('To Be Reversed', help='Check this box if your entry has to be reversed at the end of period.'), + 'reversal_id': fields.many2one('account.move', 'Reversal Entry', ondelete='set null', readonly=True), + } + + def _move_reversal(self, cr, uid, move, reversal_date, reversal_period_id=False, reversal_journal_id=False, + move_prefix=False, move_line_prefix=False, context=None): + """ + Create the reversal of a move + + @param move: browse instance of the move to reverse + @param reversal_date: when the reversal must be input + @param reversal_period_id: facultative period to write on the move (use the period of the date if empty + @param reversal_journal_id: facultative journal in which create the move + @param move_prefix: prefix for the move's name + @param move_line_prefix: prefix for the move line's names + + @return: Returns the id of the created reversal move + """ + if context is None: context = {} + move_line_obj = self.pool.get('account.move.line') + period_obj = self.pool.get('account.period') + period_ctx = context.copy() + period_ctx['company_id'] = move.company_id.id + + if not reversal_period_id: + reversal_period_id = period_obj.find(cr, uid, reversal_date, context=period_ctx)[0] + if not reversal_journal_id: + reversal_journal_id = move.journal_id.id + + reversal_ref = ''.join([x for x in [move_prefix, move.ref] if x]) + reversal_move_id = self.copy(cr, uid, move.id, + default={ + 'date': reversal_date, + 'period_id': reversal_period_id, + 'ref': reversal_ref, + 'journal_id': reversal_journal_id, + 'to_be_reversed': False, + }, + context=context) + + self.write(cr, uid, [move.id], + {'reversal_id': reversal_move_id, + 'to_be_reversed': True}, # ensure to_be_reversed is true if ever it was not + context=context) + + reversal_move = self.browse(cr, uid, reversal_move_id, context=context) + for reversal_move_line in reversal_move.line_id: + reversal_ml_name = ' '.join([x for x in [move_line_prefix, reversal_move_line.name] if x]) + move_line_obj.write(cr, uid, [reversal_move_line.id], + { + 'debit': reversal_move_line.credit, + 'credit': reversal_move_line.debit, + 'amount_currency': reversal_move_line.amount_currency * -1, + 'name': reversal_ml_name, + }, + context=context, + check=True, update_check=True + ) + + self.validate(cr, uid, [reversal_move_id], context=context) + return reversal_move_id + + def create_reversals(self, cr, uid, ids, reversal_date, reversal_period_id=False, reversal_journal_id=False, + move_prefix=False, move_line_prefix=False, context=None): + """ + Create the reversal of one or multiple moves + + @param reversal_date: when the reversal must be input + @param reversal_period_id: facultative period to write on the move (use the period of the date if empty + @param reversal_journal_id: facultative journal in which create the move + @param move_prefix: prefix for the move's name + @param move_line_prefix: prefix for the move line's names + + @return: Returns a list of ids of the created reversal moves + """ + if isinstance(ids, (int, long)): + ids = [ids] + + reversed_move_ids = [] + for src_move in self.browse(cr, uid, ids, context=context): + if src_move.reversal_id: + continue # skip the reversal creation if already done + + reversal_move_id = self._move_reversal(cr, uid, src_move, reversal_date, reversal_period_id=reversal_period_id, + reversal_journal_id=reversal_journal_id, move_prefix=move_prefix, + move_line_prefix=move_line_prefix, context=context) + if reversal_move_id: + reversed_move_ids.append(reversal_move_id) + + return reversed_move_ids + +account_move() diff --git a/account_reversal/account_view.xml b/account_reversal/account_view.xml new file mode 100644 index 000000000..911c57487 --- /dev/null +++ b/account_reversal/account_view.xml @@ -0,0 +1,62 @@ + + + + + + + + account.move.reversal.tree + account.move + + tree + + + + + + + + + account.move.reversal.form + account.move + + form + + + + + + + + + + account.move.reversal.select + account.move + + search + + + + + + + + + + + + + diff --git a/account_reversal/i18n/account_reversal.pot b/account_reversal/i18n/account_reversal.pot new file mode 100644 index 000000000..0e360df82 --- /dev/null +++ b/account_reversal/i18n/account_reversal.pot @@ -0,0 +1,132 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_reversal +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.1rc1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-01-31 12:37+0000\n" +"PO-Revision-Date: 2012-01-31 12:37+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_reversal +#: field:account.move.reverse,move_line_prefix:0 +msgid "Items Name Prefix" +msgstr "" + +#. module: account_reversal +#: constraint:account.move:0 +msgid "You can not create more than one move per period on centralized journal" +msgstr "" + +#. module: account_reversal +#: field:account.move.reverse,period_id:0 +msgid "Reversal Period" +msgstr "" + +#. module: account_reversal +#: view:account.move.reverse:0 +#: model:ir.actions.act_window,name:account_reversal.act_account_move_reverse +msgid "Reverse Entries" +msgstr "" + +#. module: account_reversal +#: help:account.move.reverse,move_line_prefix:0 +msgid "Prefix that will be added to the name of the journal item to be reversed to create the name of the reversal journal item (a space is added after the prefix)." +msgstr "" + +#. module: account_reversal +#: help:account.move.reverse,period_id:0 +msgid "If empty, take the period of the date." +msgstr "" + +#. module: account_reversal +#: field:account.move.reverse,journal_id:0 +msgid "Reversal Journal" +msgstr "" + +#. module: account_reversal +#: view:account.move:0 +#: field:account.move,to_be_reversed:0 +msgid "To Be Reversed" +msgstr "" + +#. module: account_reversal +#: help:account.move.reverse,journal_id:0 +msgid "If empty, uses the journal of the journal entry to be reversed." +msgstr "" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move_reverse +msgid "Create reversal of account moves" +msgstr "" + +#. module: account_reversal +#: model:ir.actions.act_window,help:account_reversal.act_account_move_reverse +msgid "This will create reversal for all selected entries whether checked \"to be reversed\" or not." +msgstr "" + +#. module: account_reversal +#: code:addons/account_reversal/wizard/account_move_reverse.py:95 +#, python-format +msgid "Reversal Entries" +msgstr "" + +#. module: account_reversal +#: view:account.move.reverse:0 +msgid "Create reversal journal entries" +msgstr "" + +#. module: account_reversal +#: field:account.move,reversal_id:0 +msgid "Reversal Entry" +msgstr "" + +#. module: account_reversal +#: help:account.move,to_be_reversed:0 +msgid "Check this box if your entry has to be reversed at the end of period." +msgstr "" + +#. module: account_reversal +#: help:account.move.reverse,date:0 +msgid "Enter the date of the reversal account entries. By default, OpenERP proposes the first day of the next period." +msgstr "" + +#. module: account_reversal +#: help:account.move.reverse,move_prefix:0 +msgid "Prefix that will be added to the 'Ref' of the journal entry to be reversed to create the 'Ref' of the reversal journal entry (no space added after the prefix)." +msgstr "" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move +msgid "Account Entry" +msgstr "" + +#. module: account_reversal +#: field:account.move.reverse,date:0 +msgid "Reversal Date" +msgstr "" + +#. module: account_reversal +#: field:account.move.reverse,move_prefix:0 +msgid "Entries Ref. Prefix" +msgstr "" + +#. module: account_reversal +#: view:account.move.reverse:0 +msgid "Cancel" +msgstr "" + +#. module: account_reversal +#: view:account.move:0 +#: model:ir.actions.act_window,name:account_reversal.action_move_to_be_reversed +#: model:ir.ui.menu,name:account_reversal.menu_move_to_be_reversed +msgid "Journal Entries to be Reversed" +msgstr "" + diff --git a/account_reversal/i18n/ca.po b/account_reversal/i18n/ca.po new file mode 100644 index 000000000..0c9a1c408 --- /dev/null +++ b/account_reversal/i18n/ca.po @@ -0,0 +1,127 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_reversal +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.2\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2011-06-10 08:02+0000\n" +"PO-Revision-Date: 2011-06-24 10:27+0000\n" +"Last-Translator: jmartin (Zikzakmedia) \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-10-28 05:57+0000\n" +"X-Generator: Launchpad (build 14197)\n" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_reconcile:0 +msgid "" +"If active, the reversal account moves will be reconciled with the original " +"account moves." +msgstr "" +"Si està actiu, la reversió dels apunts comptables es conciliaran amb els " +"apunts comptables originals." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_date:0 +msgid "Date of reversals" +msgstr "Data de reversions" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move +msgid "Account Entry" +msgstr "Assentament comptable" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_line_prefix:0 +msgid "" +"Prefix that will be added to the name of the original account move lines to " +"create the name of the reversal move lines (a space is added after the " +"prefix)." +msgstr "" +"Prefix que s'afegirà al nom original dels apunts comptables per crear el nom " +"dels apunts revertits (s'afegeix un espai després del prefix)." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_reconcile:0 +msgid "Reconcile reversals" +msgstr "Concilia les reversions" + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_ref_prefix:0 +msgid "Prefix for Ref of reversal moves" +msgstr "Prefix per a les referències dels apunts revertits" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_ref_prefix:0 +msgid "" +"Prefix that will be added to the 'Ref' of the original account moves to " +"create the 'Ref' of the reversal moves (no space added after the prefix)." +msgstr "" +"Prefix que s'afegirà a la referència dels apunts comptables originals per " +"crear la referència dels apunts revertits (no s'afegeix cap espai després " +"del prefix)." + +#. module: account_reversal +#: constraint:account.move:0 +msgid "" +"You cannot create more than one move per period on centralized journal" +msgstr "No podeu crear més d'un apunt per període a un diari centralitzat." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_line_prefix:0 +msgid "Prefix for Name of reversal move lines" +msgstr "Prefix per als noms dels apunts revertits" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_reversal_wizard +msgid "Wizard to reverse an account move" +msgstr "Assistent per revertir un assentament comptable" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Create reversals" +msgstr "Crea reversió" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Create reversal account moves" +msgstr "Crea un assentament comptable revertit" + +#. module: account_reversal +#: constraint:account.move:0 +msgid "" +"You cannot create entries on different periods/journals in the same move" +msgstr "" +"No podeu crear apunts a diaris/períodes diferents en el mateix assentament." + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_date:0 +msgid "" +"Enter the date of the reversal account moves. By default, OpenERP proposes " +"the first day of the next period." +msgstr "" +"Introduïu la data de reversió de l'assentament comptable. Per defecte, " +"OpenERP proposa el primer dia del següent període comptable." + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Cancel" +msgstr "Cancel·la" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "" +"This wizard will generate a reversal account move for each account move " +"currently selected" +msgstr "" +"Aquest assistent generarà un assentament comptable revertit per a cada " +"assentament comptable seleccionat." + +#. module: account_reversal +#: model:ir.actions.act_window,name:account_reversal.act_account_reversal_wizard +msgid "Create reversals wizard" +msgstr "Assistent de creació de reversions" diff --git a/account_reversal/i18n/es.po b/account_reversal/i18n/es.po new file mode 100644 index 000000000..815d13b10 --- /dev/null +++ b/account_reversal/i18n/es.po @@ -0,0 +1,129 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_reversal +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.2\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2011-06-10 08:02+0000\n" +"PO-Revision-Date: 2011-06-24 10:26+0000\n" +"Last-Translator: jmartin (Zikzakmedia) \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-10-28 05:57+0000\n" +"X-Generator: Launchpad (build 14197)\n" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_reconcile:0 +msgid "" +"If active, the reversal account moves will be reconciled with the original " +"account moves." +msgstr "" +"Si está activo, la reversión de los apuntes contables se conciliarán con los " +"apuntes contables originales." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_date:0 +msgid "Date of reversals" +msgstr "Fecha de reversiones" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move +msgid "Account Entry" +msgstr "Asiento contable" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_line_prefix:0 +msgid "" +"Prefix that will be added to the name of the original account move lines to " +"create the name of the reversal move lines (a space is added after the " +"prefix)." +msgstr "" +"Prefijo que se añadirá al nombre original de los apuntes contables para " +"crear el nombre de los apuntes contables revertidos (se añade un espacio " +"después del prefijo)." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_reconcile:0 +msgid "Reconcile reversals" +msgstr "Concilia las reversiones" + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_ref_prefix:0 +msgid "Prefix for Ref of reversal moves" +msgstr "Prefijo para las referencias de los apuntes revertidos" + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_ref_prefix:0 +msgid "" +"Prefix that will be added to the 'Ref' of the original account moves to " +"create the 'Ref' of the reversal moves (no space added after the prefix)." +msgstr "" +"Prefijo que se añadirá a la referencia de los apuntes contables originales " +"para crear la referencia de los apuntes revertidos (no se añade ningún " +"espacio después del prefijo)." + +#. module: account_reversal +#: constraint:account.move:0 +msgid "" +"You cannot create more than one move per period on centralized journal" +msgstr "" +"No puede crear más de un apunte por periodo en un diario centralizado." + +#. module: account_reversal +#: field:account.reversal.wizard,reversal_line_prefix:0 +msgid "Prefix for Name of reversal move lines" +msgstr "Prefijo para los nombres de los apuntes revertidos" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_reversal_wizard +msgid "Wizard to reverse an account move" +msgstr "Asistente para revertir un asiento contable" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Create reversals" +msgstr "Crear reversión" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Create reversal account moves" +msgstr "Crear un asiento contable revertido" + +#. module: account_reversal +#: constraint:account.move:0 +msgid "" +"You cannot create entries on different periods/journals in the same move" +msgstr "" +"No puede crear apuntes en diarios/periodos diferentes en el mismo asiento." + +#. module: account_reversal +#: help:account.reversal.wizard,reversal_date:0 +msgid "" +"Enter the date of the reversal account moves. By default, OpenERP proposes " +"the first day of the next period." +msgstr "" +"Introduzca la fecha de reversión del asiento contable. Por defecto, OpenERP " +"propone el primer día del siguiente periodo contable." + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "Cancel" +msgstr "Cancelar" + +#. module: account_reversal +#: view:account.reversal.wizard:0 +msgid "" +"This wizard will generate a reversal account move for each account move " +"currently selected" +msgstr "" +"Este asistente generará un asiento contable revertido para cada asiento " +"contable seleccionado." + +#. module: account_reversal +#: model:ir.actions.act_window,name:account_reversal.act_account_reversal_wizard +msgid "Create reversals wizard" +msgstr "Asistente de creación de reversiones" diff --git a/account_reversal/i18n/fr.po b/account_reversal/i18n/fr.po new file mode 100644 index 000000000..446464246 --- /dev/null +++ b/account_reversal/i18n/fr.po @@ -0,0 +1,165 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_reversal +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-01-31 12:37+0000\n" +"PO-Revision-Date: 2012-01-31 13:50+0100\n" +"Last-Translator: Guewen Baconnier \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-10-28 05:57+0000\n" +"X-Generator: Launchpad (build 14197)\n" + +#. module: account_reversal +#: field:account.move.reverse,move_line_prefix:0 +msgid "Items Name Prefix" +msgstr "Préfixe pour les écritures comptables d'extourne" + +#. module: account_reversal +#: constraint:account.move:0 +msgid "You can not create more than one move per period on centralized journal" +msgstr "Vous ne pouvez pas créer plus d'une écriture par période sur un journal centralisé" + +#. module: account_reversal +#: field:account.move.reverse,period_id:0 +msgid "Reversal Period" +msgstr "Période des extournes" + +#. module: account_reversal +#: view:account.move.reverse:0 +#: model:ir.actions.act_window,name:account_reversal.act_account_move_reverse +msgid "Reverse Entries" +msgstr "Créer les pièces comptables d'extourne" + +#. module: account_reversal +#: help:account.move.reverse,move_line_prefix:0 +msgid "Prefix that will be added to the name of the journal item to be reversed to create the name of the reversal journal item (a space is added after the prefix)." +msgstr "Préfixe qui sera ajouté au libellé des écritures comptables originales pour créer le libellé des écritures comptables d'extourne (un espace est ajouté après le préfixe)." + +#. module: account_reversal +#: help:account.move.reverse,period_id:0 +msgid "If empty, take the period of the date." +msgstr "Si laissé vide, utilise la période correspondant à la date de la pièce comptable" + +#. module: account_reversal +#: field:account.move.reverse,journal_id:0 +msgid "Reversal Journal" +msgstr "Journal des extournes" + +#. module: account_reversal +#: view:account.move:0 +#: field:account.move,to_be_reversed:0 +msgid "To Be Reversed" +msgstr "Extourne nécessaire" + +#. module: account_reversal +#: help:account.move.reverse,journal_id:0 +msgid "If empty, uses the journal of the journal entry to be reversed." +msgstr "Si laissé vide, le journal de la pièce comptable à extourner sera conservé" + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move_reverse +msgid "Create reversal of account moves" +msgstr "Créer des pièces comptables d'extourne" + +#. module: account_reversal +#: model:ir.actions.act_window,help:account_reversal.act_account_move_reverse +msgid "This will create reversal for all selected entries whether checked \"to be reversed\" or not." +msgstr "Ceci va créer les extournes de pièces comptables pour toutes les pièces sélectionnées" + +#. module: account_reversal +#: code:addons/account_reversal/wizard/account_move_reverse.py:95 +#, python-format +msgid "Reversal Entries" +msgstr "Extournes de pièces comptables" + +#. module: account_reversal +#: view:account.move.reverse:0 +msgid "Create reversal journal entries" +msgstr "Créer des pièces comptables d'extourne" + +#. module: account_reversal +#: field:account.move,reversal_id:0 +msgid "Reversal Entry" +msgstr "Extourne de pièce comptable" + +#. module: account_reversal +#: help:account.move,to_be_reversed:0 +msgid "Check this box if your entry has to be reversed at the end of period." +msgstr "Cochez cette case si votre pièce comptable doit être extournée à la fin de la période." + +#. module: account_reversal +#: help:account.move.reverse,date:0 +msgid "Enter the date of the reversal account entries. By default, OpenERP proposes the first day of the next period." +msgstr "Entrer la date des pièces comptables d'extourne. Par défaut, OpenERP propose le premier jour de la période comptable suivante." + +#. module: account_reversal +#: help:account.move.reverse,move_prefix:0 +msgid "Prefix that will be added to the 'Ref' of the journal entry to be reversed to create the 'Ref' of the reversal journal entry (no space added after the prefix)." +msgstr "Préfixe qui sera ajouté aux références des pièces comptables originales pour créer les références des pièces d'extourne (pas d'espace ajouté après le préfixe)." + +#. module: account_reversal +#: model:ir.model,name:account_reversal.model_account_move +msgid "Account Entry" +msgstr "Pièce comptable" + +#. module: account_reversal +#: field:account.move.reverse,date:0 +msgid "Reversal Date" +msgstr "Date des extournes" + +#. module: account_reversal +#: field:account.move.reverse,move_prefix:0 +msgid "Entries Ref. Prefix" +msgstr "Préfixe pour les références des pièces comptables d'extourne" + +#. module: account_reversal +#: view:account.move.reverse:0 +msgid "Cancel" +msgstr "Annuler" + +#. module: account_reversal +#: view:account.move:0 +#: model:ir.actions.act_window,name:account_reversal.action_move_to_be_reversed +#: model:ir.ui.menu,name:account_reversal.menu_move_to_be_reversed +msgid "Journal Entries to be Reversed" +msgstr "Pièces comptables à extourner" + +#~ msgid "" +#~ "If active, the reversal account moves will be reconciled with the " +#~ "original account moves." +#~ msgstr "" +#~ "Si activé, les écritures comptables d'extourne seront réconciliées avec " +#~ "les écritures initiales." +#~ msgid "Date of reversals" +#~ msgstr "Date des extournes" +#~ msgid "Reconcile reversals" +#~ msgstr "Réconcilie les extournes" +#~ msgid "Prefix for Ref of reversal moves" +#~ msgstr "Préfixe pour les références des pièces comptables d'extourne" +#~ msgid "Prefix for Name of reversal move lines" +#~ msgstr "Préfixe pour le libellé des écritures d'extourne" +#~ msgid "Wizard to reverse an account move" +#~ msgstr "Wizard to reverse an account move" +#~ msgid "Create reversals" +#~ msgstr "Créer les extournes" +#~ msgid "" +#~ "You cannot create entries on different periods/journals in the same move" +#~ msgstr "" +#~ "Impossible d'enregistrer des lignes sur des périodes ou des journaux " +#~ "différents dans la même écriture" +#~ msgid "" +#~ "This wizard will generate a reversal account move for each account move " +#~ "currently selected" +#~ msgstr "" +#~ "Cet assistant va générer une pièce comptable d'extourne pour chaque pièce " +#~ "comptable actuellement sélectionnée" +#~ msgid "Create reversals wizard" +#~ msgstr "Assistant de création d'extournes" + diff --git a/account_reversal/wizard/__init__.py b/account_reversal/wizard/__init__.py new file mode 100644 index 000000000..cbd7265f9 --- /dev/null +++ b/account_reversal/wizard/__init__.py @@ -0,0 +1 @@ +import account_move_reverse diff --git a/account_reversal/wizard/account_move_reverse.py b/account_reversal/wizard/account_move_reverse.py new file mode 100644 index 000000000..e720e6dcf --- /dev/null +++ b/account_reversal/wizard/account_move_reverse.py @@ -0,0 +1,99 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Account reversal module for OpenERP +# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved +# @author Alexis de Lattre +# Copyright (c) 2012 Camptocamp SA (http://www.camptocamp.com) +# @author Guewen Baconnier +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + + + +from osv import osv, fields +from tools.translate import _ + + +class account_move_reversal(osv.osv_memory): + _name = "account.move.reverse" + _description = "Create reversal of account moves" + + _columns = { + 'date': fields.date('Reversal Date', required=True, help="Enter the date of the reversal account entries. By default, OpenERP proposes the first day of the next period."), + 'period_id': fields.many2one('account.period', 'Reversal Period', help="If empty, take the period of the date."), + 'journal_id': fields.many2one('account.journal', 'Reversal Journal', help='If empty, uses the journal of the journal entry to be reversed.'), + 'move_prefix': fields.char('Entries Ref. Prefix', size=32, help="Prefix that will be added to the 'Ref' of the journal entry to be reversed to create the 'Ref' of the reversal journal entry (no space added after the prefix)."), + 'move_line_prefix': fields.char('Items Name Prefix', size=32, help="Prefix that will be added to the name of the journal item to be reversed to create the name of the reversal journal item (a space is added after the prefix)."), + } + + def _next_period_first_date(self, cr, uid, context=None): + if context is None: + context = {} + period_obj = self.pool.get('account.period') + current_period_id = period_obj.find(cr, uid, context=context)[0] + current_period = period_obj.browse(cr, uid, current_period_id, context=context) + next_period_id = period_obj.next(cr, uid, current_period, 1, context=context) + next_period = period_obj.browse(cr, uid, next_period_id, context=context) + return next_period.date_start + + _defaults = { + 'date': _next_period_first_date, + 'move_line_prefix': lambda *a: 'REV -', + } + + def action_reverse(self, cr, uid, ids, context=None): + if context is None: + context = {} + form = self.read(cr, uid, ids, context=context)[0] + + action = {'type': 'ir.actions.act_window_close'} + + if context.get('active_ids', False): + mod_obj = self.pool.get('ir.model.data') + act_obj = self.pool.get('ir.actions.act_window') + move_obj = self.pool.get('account.move') + move_ids = context['active_ids'] + + period_id = form.get('period_id', False) and form['period_id'][0] or False + journal_id = form.get('journal_id', False) and form['journal_id'][0] or False + reversed_move_ids = move_obj.create_reversals( + cr, uid, + move_ids, + form['date'], + reversal_period_id=period_id, + reversal_journal_id=journal_id, + move_prefix=form['move_prefix'], + move_line_prefix=form['move_line_prefix'], + context=context) + + action_ref = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_journal_line') + action_id = action_ref and action_ref[1] or False + action = act_obj.read(cr, uid, [action_id], context=context)[0] + action['domain'] = str([('id', 'in', reversed_move_ids)]) + action['name'] = _('Reversal Entries') + action['context'] = unicode({'search_default_to_be_reversed': 0}) + return action + +account_move_reversal() diff --git a/account_reversal/wizard/account_move_reverse_view.xml b/account_reversal/wizard/account_move_reverse_view.xml new file mode 100644 index 000000000..bc6c2c6fe --- /dev/null +++ b/account_reversal/wizard/account_move_reverse_view.xml @@ -0,0 +1,46 @@ + + + + + + account.move.reverse.form + account.move.reverse + form + +
+ + + + + + + + + + + + + + + +
+ + + Add to_be_reversed filter + account.move + + + + + + + + + + + + + diff --git a/account_reversal/wizard/__init__.py b/account_reversal/wizard/__init__.py index 5961f0fc1..5f47c9160 100644 --- a/account_reversal/wizard/__init__.py +++ b/account_reversal/wizard/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import account_move_reverse diff --git a/account_reversal/wizard/account_move_reverse.py b/account_reversal/wizard/account_move_reverse.py index 805310ec9..35603ed6a 100644 --- a/account_reversal/wizard/account_move_reverse.py +++ b/account_reversal/wizard/account_move_reverse.py @@ -1,116 +1,75 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Account reversal module for OpenERP -# Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved -# @author Alexis de Lattre -# Copyright (c) 2012-2013 Camptocamp SA (http://www.camptocamp.com) -# @author Guewen Baconnier -# -# -# 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 . -# -############################################################################## +# Copyright 2011 Alexis de Lattre +# Copyright 2012-2013 Guewen Baconnier (Camptocamp) +# Copyright 2016 Antonio Espinosa +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.osv import orm, fields -from openerp.tools.translate import _ +from odoo import api, fields, models, _ -class account_move_reversal(orm.TransientModel): +class AccountMoveReverse(models.TransientModel): _name = "account.move.reverse" _description = "Create reversal of account moves" - _columns = { - 'date': fields.date( - 'Reversal Date', - required=True, - help="Enter the date of the reversal account entries. " - "By default, OpenERP proposes the first day of " - "the next period."), - 'period_id': fields.many2one( - 'account.period', - 'Reversal Period', - help="If empty, take the period of the date."), - 'journal_id': fields.many2one( - 'account.journal', - 'Reversal Journal', - help='If empty, uses the journal of the journal entry ' - 'to be reversed.'), - 'move_prefix': fields.char( - 'Entries Ref. Prefix', - help="Prefix that will be added to the 'Ref' of the journal " - "entry to be reversed to create the 'Ref' of the " - "reversal journal entry (no space added after the prefix)."), - 'move_line_prefix': fields.char( - 'Items Name Prefix', - help="Prefix that will be added to the name of the journal " - "item to be reversed to create the name of the reversal " - "journal item (a space is added after the prefix)."), - } + def _default_date(self): + active_id = (self.env.context.get('active_id') or + self.env.context.get('active_ids', [None])[0]) + move = self.env['account.move'].browse(active_id) + return move.date or fields.Date.today() - def _next_period_first_date(self, cr, uid, context=None): - if context is None: - context = {} - res = False - period_ctx = context.copy() - period_ctx['account_period_prefer_normal'] = True - period_obj = self.pool.get('account.period') - today_period_id = period_obj.find(cr, uid, context=period_ctx) - if today_period_id: - today_period = period_obj.browse( - cr, uid, today_period_id[0], context=context) - next_period_id = period_obj.next( - cr, uid, today_period, 1, context=context) - if next_period_id: - next_period = period_obj.browse( - cr, uid, next_period_id, context=context) - res = next_period.date_start - return res + def _default_journal_id(self): + active_id = (self.env.context.get('active_id') or + self.env.context.get('active_ids', [None])[0]) + move = self.env['account.move'].browse(active_id) + return move.journal_id.id - _defaults = { - 'date': _next_period_first_date, - 'move_line_prefix': 'REV -', - } + date = fields.Date( + string="Reversal Date", required=True, default=_default_date, + help="Enter the date of the reversal account entries. " + "By default, Odoo proposes the same date of the move to reverse.") + journal_id = fields.Many2one( + comodel_name='account.journal', string="Reversal Journal", + default=_default_journal_id, + help="Enter the date of the reversal account entries. " + "If empty, Odoo uses the same journal of the move to reverse.") + move_prefix = fields.Char( + string="Entries Ref. Prefix", + help="Prefix that will be added to the 'Ref' of the reversal account " + "entries. If empty, Odoo uses the Ref of the move to reverse. " + "(NOTE: A space is added after the prefix).") + line_prefix = fields.Char( + string="Items Name Prefix", + help="Prefix that will be added to the 'Name' of the reversal account " + "entrie items. If empty, Odoo uses the same name of the move " + "line to reverse. (NOTE: A space is added after the prefix).") + reconcile = fields.Boolean( + string="Reconcile", default=True, + help="Mark this if you want to reconcile items of both moves.") - def action_reverse(self, cr, uid, ids, context=None): - if context is None: - context = {} - assert 'active_ids' in context, "active_ids missing in context" - - form = self.read(cr, uid, ids, context=context)[0] - - mod_obj = self.pool.get('ir.model.data') - act_obj = self.pool.get('ir.actions.act_window') - move_obj = self.pool.get('account.move') - move_ids = context['active_ids'] - - period_id = form['period_id'][0] if form.get('period_id') else False - journal_id = form['journal_id'][0] if form.get('journal_id') else False - reversed_move_ids = move_obj.create_reversals( - cr, uid, - move_ids, - form['date'], - reversal_period_id=period_id, - reversal_journal_id=journal_id, - move_prefix=form['move_prefix'], - move_line_prefix=form['move_line_prefix'], - context=context) - - __, action_id = mod_obj.get_object_reference( - cr, uid, 'account', 'action_move_journal_line') - action = act_obj.read(cr, uid, [action_id], context=context)[0] - action['domain'] = unicode([('id', 'in', reversed_move_ids)]) - action['name'] = _('Reversal Entries') - action['context'] = unicode({'search_default_to_be_reversed': 0}) + @api.multi + def action_reverse(self): + moves = self.env['account.move'] + for wizard in self: + orig = moves.browse(self.env.context.get('active_ids')) + moves |= orig.create_reversals( + date=wizard.date, journal=wizard.journal_id, + move_prefix=wizard.move_prefix, line_prefix=wizard.line_prefix, + reconcile=wizard.reconcile) + action = { + 'name': _('Reverse moves'), + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'res_model': 'account.move', + 'context': {'search_default_to_be_reversed': 0}, + } + if len(moves) == 1: + action.update({ + 'view_mode': 'form,tree', + 'res_id': moves.id, + }) + else: + action.update({ + 'view_mode': 'tree,form', + 'domain': [('id', 'in', moves.ids)], + }) return action diff --git a/account_reversal/wizard/account_move_reverse_view.xml b/account_reversal/wizard/account_move_reverse_view.xml index f771ca621..546b4e645 100644 --- a/account_reversal/wizard/account_move_reverse_view.xml +++ b/account_reversal/wizard/account_move_reverse_view.xml @@ -1,47 +1,49 @@ - - + - - account.move.reverse.form - account.move.reverse - -
-
-
+ + account.move.reverse.form + account.move.reverse + +
+
+
- - Reverse Entries - client_action_multi - account.move - - + + Reverse Entries + account.move.reverse + form + + new + -
-
+ + + + + From 6e06300c8491a152b0a686de59ce28581546bec2 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Fri, 3 Nov 2017 20:50:33 +0100 Subject: [PATCH 57/58] [11.0][MIG] account_reversal migration --- account_reversal/README.rst | 12 ++++++------ account_reversal/__init__.py | 2 -- account_reversal/__manifest__.py | 3 +-- account_reversal/models/__init__.py | 2 -- account_reversal/models/account_move.py | 3 +-- account_reversal/views/account_move_view.xml | 11 ++++------- account_reversal/wizard/__init__.py | 1 - account_reversal/wizard/account_move_reverse.py | 1 - .../wizard/account_move_reverse_view.xml | 8 ++------ setup/account_reversal/odoo/__init__.py | 1 + setup/account_reversal/odoo/addons/__init__.py | 1 + setup/account_reversal/odoo/addons/account_reversal | 1 + setup/account_reversal/setup.py | 6 ++++++ 13 files changed, 23 insertions(+), 29 deletions(-) create mode 100644 setup/account_reversal/odoo/__init__.py create mode 100644 setup/account_reversal/odoo/addons/__init__.py create mode 120000 setup/account_reversal/odoo/addons/account_reversal create mode 100644 setup/account_reversal/setup.py diff --git a/account_reversal/README.rst b/account_reversal/README.rst index d7608337a..41cc77c0b 100644 --- a/account_reversal/README.rst +++ b/account_reversal/README.rst @@ -1,5 +1,5 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 Account Reversal @@ -12,7 +12,7 @@ Also add on account entries: * a checkbox and filter "to be reversed" * a link between an entry and its reversal entry -Odoo v9c include a similar action (overwritten by this addon), but with less +Odoo v11c include a similar action (overwritten by this addon), but with less features, for instance: * Allowing inheritance @@ -23,22 +23,22 @@ features, for instance: Usage ===== -As in Odoo v9c, if you select an entry from Accounting > Adviser > Journal Entries, +If you select an entry from Invoicing > Adviser > Journal Entries, then an action menu 'Reverse Entries' is available. If clicked, then a wizard allows user to select Reversal Date, Reversal Journal, Prefix, Post and Reconcile. * If no Reversal Journal is selected, then the same journal is used * If Post is True, then reversal entry will be posted else it will be leaved - as a draft entry + as a draft entry. * If Post and Reconcile are True, then all entry lines with reconciled accounts of the entry will be reconciled with the reserval entry ones. -There is also a new menu Accounting > Adviser > Journal Entries to be Reversed +There is also a new menu Invoicing > Adviser > Journal Entries to be Reversed in order to allow tracking entries that must be reserved for any reason. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/92/9.0 + :target: https://runbot.odoo-community.org/runbot/92/11.0 Credits diff --git a/account_reversal/__init__.py b/account_reversal/__init__.py index 2eb723313..0217b0f92 100644 --- a/account_reversal/__init__.py +++ b/account_reversal/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models from . import wizard diff --git a/account_reversal/__manifest__.py b/account_reversal/__manifest__.py index 16bd62c0c..c3cac969e 100644 --- a/account_reversal/__manifest__.py +++ b/account_reversal/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2011 Alexis de Lattre # Copyright 2012-2013 Guewen Baconnier (Camptocamp) # Copyright 2016 Antonio Espinosa @@ -7,7 +6,7 @@ { "name": "Account Reversal", "summary": "Wizard for creating a reversal account move", - "version": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Accounting & Finance", "website": "https://odoo-community.org/", "author": "Akretion," diff --git a/account_reversal/models/__init__.py b/account_reversal/models/__init__.py index 69fc58050..02e45447f 100644 --- a/account_reversal/models/__init__.py +++ b/account_reversal/models/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import account_move diff --git a/account_reversal/models/account_move.py b/account_reversal/models/account_move.py index 7ccdeab52..19f3a1b7f 100644 --- a/account_reversal/models/account_move.py +++ b/account_reversal/models/account_move.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2011 Alexis de Lattre # Copyright 2011 Nicolas Bessi (Camptocamp) # Copyright 2012-2013 Guewen Baconnier (Camptocamp) @@ -82,7 +81,7 @@ class AccountMove(models.Model): lines = move.line_ids.filtered('account_id.reconcile') for line in lines: rec[(line.account_id, line.partner_id)] += line - for lines in rec.itervalues(): + for lines in list(rec.values()): lines.reconcile() return True diff --git a/account_reversal/views/account_move_view.xml b/account_reversal/views/account_move_view.xml index 09863ab0b..fba7f5096 100644 --- a/account_reversal/views/account_move_view.xml +++ b/account_reversal/views/account_move_view.xml @@ -20,13 +20,10 @@ account.move - - - - + + + diff --git a/account_reversal/wizard/__init__.py b/account_reversal/wizard/__init__.py index 5f47c9160..c9a862adb 100644 --- a/account_reversal/wizard/__init__.py +++ b/account_reversal/wizard/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import account_move_reverse diff --git a/account_reversal/wizard/account_move_reverse.py b/account_reversal/wizard/account_move_reverse.py index 35603ed6a..fe84d22df 100644 --- a/account_reversal/wizard/account_move_reverse.py +++ b/account_reversal/wizard/account_move_reverse.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2011 Alexis de Lattre # Copyright 2012-2013 Guewen Baconnier (Camptocamp) # Copyright 2016 Antonio Espinosa diff --git a/account_reversal/wizard/account_move_reverse_view.xml b/account_reversal/wizard/account_move_reverse_view.xml index 546b4e645..130e9ed0c 100644 --- a/account_reversal/wizard/account_move_reverse_view.xml +++ b/account_reversal/wizard/account_move_reverse_view.xml @@ -33,17 +33,13 @@ - + Reverse Entries account.move.reverse form new - - - - + diff --git a/setup/account_reversal/odoo/__init__.py b/setup/account_reversal/odoo/__init__.py new file mode 100644 index 000000000..de40ea7ca --- /dev/null +++ b/setup/account_reversal/odoo/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/account_reversal/odoo/addons/__init__.py b/setup/account_reversal/odoo/addons/__init__.py new file mode 100644 index 000000000..de40ea7ca --- /dev/null +++ b/setup/account_reversal/odoo/addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/account_reversal/odoo/addons/account_reversal b/setup/account_reversal/odoo/addons/account_reversal new file mode 120000 index 000000000..0c9904605 --- /dev/null +++ b/setup/account_reversal/odoo/addons/account_reversal @@ -0,0 +1 @@ +../../../../account_reversal \ No newline at end of file diff --git a/setup/account_reversal/setup.py b/setup/account_reversal/setup.py new file mode 100644 index 000000000..999b290c8 --- /dev/null +++ b/setup/account_reversal/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) \ No newline at end of file From f6e06225810ea95b0f4cdfd9b1a07d465c25f775 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Mon, 6 Nov 2017 11:28:21 +0100 Subject: [PATCH 58/58] Improve test --- account_reversal/tests/test_account_reversal.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/account_reversal/tests/test_account_reversal.py b/account_reversal/tests/test_account_reversal.py index 535b96d16..0ee9d6c78 100644 --- a/account_reversal/tests/test_account_reversal.py +++ b/account_reversal/tests/test_account_reversal.py @@ -70,8 +70,15 @@ class TestAccountReversal(TransactionCase): self._move_str(move), '0.00100.00:SALE_100.000.00:CUSTOMER_') move_prefix = 'REV_TEST_MOVE:' line_prefix = 'REV_TEST_LINE:' - rev = move.create_reversals(move_prefix=move_prefix, - line_prefix=line_prefix, reconcile=True) + wizard = self.env['account.move.reverse'].with_context( + active_ids=move.ids + ).create({ + 'move_prefix': move_prefix, + 'line_prefix': line_prefix + }) + self.assertEqual(wizard.date, move.date) + res = wizard.action_reverse() + rev = self.env['account.move'].browse(res['res_id']) self.assertEqual(len(rev), 1) self.assertEqual(rev.state, 'posted') self.assertEqual(