[FIX] flake8 PEP8 account_partner_required

This commit is contained in:
Nicolas Bessi
2014-07-10 16:36:45 +02:00
parent f6a5658a23
commit 4f9d891330
4 changed files with 15 additions and 16 deletions

View File

@@ -19,7 +19,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""
Account renumber wizard
"""

View File

@@ -29,7 +29,7 @@
'author': "Pexego",
'website': "http://www.pexego.es",
'category': "Enterprise Specific Modules",
'contributors' : ['Pedro M. Baeza', 'Joaquín Gutierrez'],
'contributors': ['Pedro M. Baeza', 'Joaquín Gutierrez'],
'description': """
This module adds a wizard to renumber account moves by date only for admin users.
=================================================================================
@@ -43,11 +43,11 @@ It will recreate the sequence number of each account move using their journal se
- Sequences per journal are supported.
- Sequences with prefixes and sufixes based on the move date are also supported.
""",
"license" : "AGPL-3",
"depends" : [
"license": "AGPL-3",
"depends": [
'account',
],
"demo" : [],
"demo": [],
"data": [
'wizard/wizard_renumber_view.xml',
],

View File

@@ -19,11 +19,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
"""
Account renumber wizard
"""
import wizard_renumber

View File

@@ -24,6 +24,7 @@ from openerp.tools.translate import _
from openerp import SUPERUSER_ID
import logging
class wizard_renumber(orm.TransientModel):
_name = "wizard.renumber"
_description = "Account renumber wizard"
@@ -41,7 +42,7 @@ class wizard_renumber(orm.TransientModel):
help='Fiscal periods to renumber',
string="Periods", ondelete='null'),
'number_next': fields.integer('First Number', required=True,
help="Journal sequences will start counting on this number"),
help="Journal sequences will start counting on this number"),
'state': fields.selection([('init', 'Initial'),
('renumber', 'Renumbering')], readonly=True)
}
@@ -94,24 +95,26 @@ class wizard_renumber(orm.TransientModel):
[('journal_id', 'in', journal_ids),
('period_id', '=', period),
('state', '=', 'posted')],
limit=0, order='date,id',
context=context)
limit=0, order='date,id',
context=context)
if not move_ids:
continue
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,
sequence_id=move.journal_id.sequence_id.id,
fiscalyear_id=move.period_id.fiscalyear_id.id)
cr, uid,
sequence_id=move.journal_id.sequence_id.id,
fiscalyear_id=move.period_id.fiscalyear_id.id
)
if not sequence_id in sequences_seen:
sequence_obj.write(cr, SUPERUSER_ID, [sequence_id],
{'number_next': number_next})
sequences_seen.append(sequence_id)
# Generate (using our own get_id) and write the new move number
c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
new_name = sequence_obj.next_by_id(cr,uid,
move.journal_id.sequence_id.id, context=c)
new_name = sequence_obj.next_by_id(cr, uid,
move.journal_id.sequence_id.id,
context=c)
# Note: We can't just do a
# "move_obj.write(cr, uid, [move.id], {'name': new_name})"
# cause it might raise a