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