[FIX] account: passing ir_sequence_date in the context when calling next_by_id to replace the old behavior with fiscalyear_id in the context

This commit is contained in:
qdp-odoo
2015-02-02 11:05:14 +01:00
parent 5a1ea01d8a
commit 72db7633b1
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1320,7 +1320,7 @@ class account_move(osv.osv):
new_name = invoice.internal_number
else:
if journal.sequence_id:
c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
c = {'ir_sequence_date': move.period_id.date_start}
new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c)
else:
raise UserError(_('Please define a sequence on the journal.'))
+1 -1
View File
@@ -77,7 +77,7 @@ class account_bank_statement(osv.osv):
context = dict(context or {})
obj_seq = self.pool.get('ir.sequence')
period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context)
context['fiscalyear_id'] = period.fiscalyear_id.id
context['ir_sequence_date'] = period.date_start
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, None)
return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context)
+1 -1
View File
@@ -272,7 +272,7 @@ class account_cash_statement(osv.osv):
raise AccessError((_('You do not have rights to open this %s journal!') % (statement.journal_id.name, )))
if statement.name and statement.name == '/':
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
c = {'ir_sequence_date': statement.period_id.date_start}
if statement.journal_id.sequence_id:
st_number = obj_seq.next_by_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
else:
+1 -1
View File
@@ -1057,7 +1057,7 @@ class account_voucher(osv.osv):
if not voucher.journal_id.sequence_id.active:
raise UserError(_('Please activate the sequence of selected journal !'))
c = dict(context)
c.update({'fiscalyear_id': voucher.period_id.fiscalyear_id.id})
c.update({'ir_sequence_date': voucher.period_id.date_start})
name = seq_obj.next_by_id(cr, uid, voucher.journal_id.sequence_id.id, context=c)
else:
raise UserError(_('Please define a sequence on the journal.'))