From 65cfe5d961bc6e5721336dad6716bd491db4c49d Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Tue, 31 Jan 2012 13:53:19 +0100 Subject: [PATCH] [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 + +
+ + + + + + + + + +