summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2011-09-29 14:48:58 +0200
committerVo Minh Thu <vmt@openerp.com>2011-09-29 14:48:58 +0200
commit6c90db2ddee959e90bcffca7feb53d3d10e2b404 (patch)
tree6a5125d7e28347a94e2595a462293998faaa318a /addons
parent6c1d725c21b82cf1b38e7fe19e2926cd5116237f (diff)
[IMP] ir_sequence: adapt addons code to server changes.
bzr revid: vmt@openerp.com-20110929124858-9nr2gbpuxc6k7ofx
Diffstat (limited to 'addons')
-rw-r--r--addons/account/sequence.py29
1 files 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: