[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)
This commit is contained in:
@
2012-01-31 13:53:19 +01:00
committed by Jordi Ballester
parent 4c22e2e688
commit 65cfe5d961
11 changed files with 957 additions and 0 deletions

View File

@@ -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 <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_reversal
import wizard

View File

@@ -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 <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': '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 <alexis.delattre@akretion.com> 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,
}

View File

@@ -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 <alexis.delattre@akretion.com>
# with the kind advice of Nicolas Bessi from Camptocamp
# Copyright (C) 2012 Camptocamp SA (http://www.camptocamp.com). All Rights Reserved
# @author Guewen Baconnier <guewen.baconnier@camptocamp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
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()

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Account reversal module for OpenERP
Copyright (C) 2011 Akretion (http://www.akretion.com). All Rights Reserved
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="view_move_reversal_tree" model="ir.ui.view">
<field name="name">account.move.reversal.tree</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_tree" />
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="to_check" position="after">
<field name="to_be_reversed"/>
</field>
</field>
</record>
<record id="view_move_reversal_form" model="ir.ui.view">
<field name="name">account.move.reversal.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/group/field[@name='company_id']" position="after">
<field name="to_be_reversed"/>
<field name="reversal_id" attrs="{'invisible': [('to_be_reversed','=',False)]}"/>
</xpath>
</field>
</record>
<record id="view_account_move_reversal_filter" model="ir.ui.view">
<field name="name">account.move.reversal.select</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_account_move_filter" />
<field name="type">search</field>
<field name="arch" type="xml">
<xpath expr="/search/group[1]/filter[3]" position="after">
<filter icon="terp-gtk-jump-to-rtl" name="to_be_reversed" string="To Be Reversed" domain="[('to_be_reversed','=',True),('reversal_id','=',False)]" help="Journal Entries to be Reversed"/>
</xpath>
</field>
</record>
<act_window
context="{'search_default_to_be_reversed':1}"
id="action_move_to_be_reversed" name="Journal Entries to be Reversed"
res_model="account.move"
view_id="account.view_move_tree"/>
<menuitem
name="Journal Entries to be Reversed" icon="STOCK_EXECUTE"
action="action_move_to_be_reversed"
id="menu_move_to_be_reversed"
parent="account.menu_account_end_year_treatments"/>
</data>
</openerp>

View File

@@ -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 ""

127
account_reversal/i18n/ca.po Normal file
View File

@@ -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) <jmartin@zikzakmedia.com>\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"

129
account_reversal/i18n/es.po Normal file
View File

@@ -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) <jmartin@zikzakmedia.com>\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"

165
account_reversal/i18n/fr.po Normal file
View File

@@ -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 <guewen.baconnier@camptocamp.com>\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"

View File

@@ -0,0 +1 @@
import account_move_reverse

View File

@@ -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 <alexis.delattre@akretion.com>
# 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()

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_move_reverse" model="ir.ui.view">
<field name="name">account.move.reverse.form</field>
<field name="model">account.move.reverse</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create reversal journal entries">
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<newline/>
<field name="move_prefix" />
<field name="move_line_prefix" />
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Reverse Entries" name="action_reverse" type="object"/>
</group>
</form>
</field>
</record>
<record id="act_account_move_reverse" model="ir.actions.act_window">
<field name="name">Reverse Entries</field>
<field name="res_model">account.move.reverse</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_account_move_reverse"/>
<field name="target">new</field>
<field name="help">This will create reversal for all selected entries whether checked "to be reversed" or not.</field>
</record>
<record id="ir_account_move_reverse" model="ir.values">
<field name="name">Reverse Entries</field>
<field name="key2">client_action_multi</field>
<field name="model">account.move</field>
<field name="value" eval="'ir.actions.act_window,%d'%act_account_move_reverse" />
<field name="object" eval="True" />
</record>
</data>
</openerp>