From ee70781dbeaa3021162b22f60cb43c3cf55b80d8 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Sat, 1 Oct 2011 01:36:30 +0200 Subject: [PATCH] [IMP] account ir_sequence fiscal year using the new _next api bzr revid: al@openerp.com-20110930233630-c8pbenf99yaekt3t --- addons/account/sequence.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/account/sequence.py b/addons/account/sequence.py index e31b09aeb67..5c9039e43c3 100644 --- a/addons/account/sequence.py +++ b/addons/account/sequence.py @@ -47,18 +47,12 @@ class ir_sequence(osv.osv): 'sequence_main_id', 'Sequences') } - def _select_by_code_or_id(self, cr, uid, sequence_code_or_id, code_or_id, - for_update_no_wait, context=None): - res = super(ir_sequence, self)._select_by_code_or_id(cr, uid, - sequence_code_or_id, code_or_id, False, context) - if not res: - return - for line in self.browse(cr, uid, res['id'], context).fiscal_ids: - if line.fiscalyear_id.id == context.get('fiscalyear_id'): - return super(ir_sequence, self)._select_by_code_or_id(cr, uid, - line.sequence_id.id, 'id', False, context) - return super(ir_sequence, self)._select_by_code_or_id(cr, uid, - res['id'], 'id', False, context) + def _next(self, cr, uid, seq_ids, context=None): + for seq in self.browse(cr, uid, seq_ids, context): + for line in seq.fiscal_ids: + if line.fiscalyear_id.id == context.get('fiscalyear_id'): + return super(ir_sequence, self)._next(cr, uid, [line.sequence_id.id], context) + return super(ir_sequence, self)._next(cr, uid, seq_ids, context) ir_sequence()