mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] Migration of account_renumber to 8.0.
This commit is contained in:
@@ -29,31 +29,31 @@
|
||||
'version': "1.0",
|
||||
'author': "Pexego",
|
||||
'website': "http://www.pexego.es",
|
||||
'category': "Enterprise Specific Modules",
|
||||
'contributors': ['Pedro M. Baeza', 'Joaquín Gutierrez'],
|
||||
'category': "Accounting & Finance",
|
||||
'contributors': ['Pedro M. Baeza', 'Jordi Llinares', 'Joaquín Gutierrez'],
|
||||
'description': """
|
||||
This module adds a wizard to renumber account moves by date only for admin.
|
||||
===========================================================================
|
||||
|
||||
The wizard, that will be added to the "End of Year Treatments",
|
||||
let's you select one or more journals and fiscal periods,
|
||||
set a starting number; and then renumber all the posted moves
|
||||
from those journals and periods sorted by date.
|
||||
The wizard, which is accesible from the "End of Period" menuitem,
|
||||
lets you select journals, periods, and a starting number. When
|
||||
launched, it renumbers all posted moves that match selected criteria
|
||||
(after ordering them by date).
|
||||
|
||||
It will recreate the sequence number of each account move
|
||||
using their journal sequence so:
|
||||
It will recreate the sequence number for each account move
|
||||
using its journal sequence, which means that:
|
||||
- Sequences per journal are supported.
|
||||
- Sequences with prefixes and sufixes based on the move
|
||||
- Sequences with prefixes and suffixes based on the move
|
||||
date are also supported.
|
||||
""",
|
||||
"license": "AGPL-3",
|
||||
"depends": [
|
||||
'account',
|
||||
'account',
|
||||
],
|
||||
"demo": [],
|
||||
"data": [
|
||||
'wizard/wizard_renumber_view.xml',
|
||||
],
|
||||
"active": False,
|
||||
'installable': False
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
@@ -24,6 +24,8 @@ from openerp.tools.translate import _
|
||||
from openerp import SUPERUSER_ID
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class wizard_renumber(orm.TransientModel):
|
||||
_name = "wizard.renumber"
|
||||
@@ -79,7 +81,6 @@ class wizard_renumber(orm.TransientModel):
|
||||
Action that renumbers all the posted moves on the given
|
||||
journal and periods, and returns their ids.
|
||||
"""
|
||||
logger = logging.getLogger("account_renumber")
|
||||
form = self.browse(cr, uid, ids[0], context=context)
|
||||
period_ids = [x.id for x in form.period_ids]
|
||||
journal_ids = [x.id for x in form.journal_ids]
|
||||
@@ -87,7 +88,7 @@ class wizard_renumber(orm.TransientModel):
|
||||
if not (period_ids and journal_ids):
|
||||
raise orm.except_orm(_('No Data Available'),
|
||||
_('No records found for your selection!'))
|
||||
logger.debug("Searching for account moves to renumber.")
|
||||
_logger.debug("Searching for account moves to renumber.")
|
||||
move_obj = self.pool['account.move']
|
||||
sequence_obj = self.pool['ir.sequence']
|
||||
sequences_seen = []
|
||||
@@ -100,7 +101,7 @@ class wizard_renumber(orm.TransientModel):
|
||||
context=context)
|
||||
if not move_ids:
|
||||
continue
|
||||
logger.debug("Renumbering %d account moves." % len(move_ids))
|
||||
_logger.debug("Renumbering %d account moves." % len(move_ids))
|
||||
for move in move_obj.browse(cr, uid, move_ids, context=context):
|
||||
sequence_id = self.get_sequence_id_for_fiscalyear_id(
|
||||
cr, uid,
|
||||
@@ -125,7 +126,7 @@ class wizard_renumber(orm.TransientModel):
|
||||
# exception.
|
||||
cr.execute('UPDATE account_move SET name=%s WHERE id=%s',
|
||||
(new_name, move.id))
|
||||
logger.debug("%d account moves renumbered." % len(move_ids))
|
||||
_logger.debug("%d account moves renumbered." % len(move_ids))
|
||||
sequences_seen = []
|
||||
form.write({'state': 'renumber'})
|
||||
data_obj = self.pool['ir.model.data']
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="name">account_renumber.form</field>
|
||||
<field name="model">wizard.renumber</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Renumber Account Moves" version="7.0">
|
||||
<form string="Renumber Account Moves">
|
||||
<field name="state" invisible="1" />
|
||||
<p>This wizard will help you renumber entries in one or more journals.</p>
|
||||
<p>Posted moves from those journals will be sorted by date and then assigned sequential numbers using their journal sequence.</p>
|
||||
Reference in New Issue
Block a user