From 6c90db2ddee959e90bcffca7feb53d3d10e2b404 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Thu, 29 Sep 2011 14:48:58 +0200 Subject: [PATCH] [IMP] ir_sequence: adapt addons code to server changes. bzr revid: vmt@openerp.com-20110929124858-9nr2gbpuxc6k7ofx --- addons/account/sequence.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/addons/account/sequence.py b/addons/account/sequence.py index 1683e5feb06..30e8d62a350 100644 --- a/addons/account/sequence.py +++ b/addons/account/sequence.py @@ -46,23 +46,18 @@ class ir_sequence(osv.osv): 'fiscal_ids': fields.one2many('account.sequence.fiscalyear', 'sequence_main_id', 'Sequences') } - def get_id(self, cr, uid, sequence_id, test='id', context=None): - if context is None: - context = {} - cr.execute('select id from ir_sequence where ' - + test + '=%s and active=%s', (sequence_id, True,)) - res = cr.dictfetchone() - if res: - for line in self.browse(cr, uid, res['id'], - context=context).fiscal_ids: - if line.fiscalyear_id.id == context.get('fiscalyear_id', False): - return super(ir_sequence, self).get_id(cr, uid, - line.sequence_id.id, - test="id", - context=context) - return super(ir_sequence, self).get_id(cr, uid, sequence_id, test, - context=context) + + 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) ir_sequence() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: