[FIX] account_voucher: when picking the next move number, put the fiscalyear in context in case the sequence is dependant of it + period_id field is required on voucher

bzr revid: qdp-launchpad@openerp.com-20130205102314-y2giy53cr8vpv6yv
This commit is contained in:
Quentin (OpenERP) 2013-02-05 11:23:14 +01:00
parent 69c97ec9e3
commit b389ebdb1f
1 changed files with 4 additions and 2 deletions

View File

@ -962,7 +962,9 @@ class account_voucher(osv.osv):
if not voucher_brw.journal_id.sequence_id.active:
raise osv.except_osv(_('Configuration Error !'),
_('Please activate the sequence of selected journal !'))
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id, context=context)
c = dict(context)
c.update({'fiscalyear_id': voucher_brw.period_id.fiscalyear_id.id})
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id, context=c)
else:
raise osv.except_osv(_('Error!'),
_('Please define a sequence on the journal.'))
@ -977,7 +979,7 @@ class account_voucher(osv.osv):
'narration': voucher_brw.narration,
'date': voucher_brw.date,
'ref': ref,
'period_id': voucher_brw.period_id and voucher_brw.period_id.id or False
'period_id': voucher_brw.period_id.id,
}
return move