From b389ebdb1f9dca4d70ab5c8feb2b639b53579803 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 5 Feb 2013 11:23:14 +0100 Subject: [PATCH] [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 --- addons/account_voucher/account_voucher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index de9cebdd09b..d615eaf7d8c 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -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