diff options
| author | Harry (Open ERP) <hmo@tinyerp.com> | 2009-11-24 20:14:05 +0530 |
|---|---|---|
| committer | Harry (Open ERP) <hmo@tinyerp.com> | 2009-11-24 20:14:05 +0530 |
| commit | d8ce3f1e2a5a55f0c28eb1cf8cb4cfcd2d6d5dab (patch) | |
| tree | f1dbd61528db0d90cebb5f2b5e4e836f00f71aef /bin/addons/base/ir/ir_sequence.py | |
| parent | dda5ed6bb1710e4690c1e01fe4265cc7db147068 (diff) | |
[FIX] replaced <TAB> with four white space.
bzr revid: hmo@tinyerp.com-20091124144405-9mzd91chohvf0uu7
Diffstat (limited to 'bin/addons/base/ir/ir_sequence.py')
| -rw-r--r-- | bin/addons/base/ir/ir_sequence.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/bin/addons/base/ir/ir_sequence.py b/bin/addons/base/ir/ir_sequence.py index 8f6eb8d8dcd..87f1e3f490e 100644 --- a/bin/addons/base/ir/ir_sequence.py +++ b/bin/addons/base/ir/ir_sequence.py @@ -47,15 +47,15 @@ class ir_sequence(osv.osv): 'number_next': fields.integer('Next Number', required=True), 'number_increment': fields.integer('Increment Number', required=True), 'padding' : fields.integer('Number padding', required=True), - 'condition': fields.char('Condition', size=250, help="If set, sequence will only be used in case this python expression matches, and will precede other sequences."), - 'weight': fields.integer('Weight',required=True, help="If two sequences match, the highest weight will be used.") + 'condition': fields.char('Condition', size=250, help="If set, sequence will only be used in case this python expression matches, and will precede other sequences."), + 'weight': fields.integer('Weight',required=True, help="If two sequences match, the highest weight will be used.") } _defaults = { 'active': lambda *a: True, 'number_increment': lambda *a: 1, 'number_next': lambda *a: 1, 'padding' : lambda *a : 0, - 'weight' : lambda *a: 10, + 'weight' : lambda *a: 10, } def _process(self, s): @@ -74,28 +74,28 @@ class ir_sequence(osv.osv): } def get_id(self, cr, uid, sequence_id, test='id=%s', context=None): - if not context: - context = {} + if not context: + context = {} try: cr.execute('SELECT id, number_next, prefix, suffix, padding, condition \ - FROM ir_sequence \ - WHERE '+test+' AND active=%s ORDER BY weight DESC, length(COALESCE(condition,\'\')) DESC \ - FOR UPDATE', (sequence_id, True)) + FROM ir_sequence \ + WHERE '+test+' AND active=%s ORDER BY weight DESC, length(COALESCE(condition,\'\')) DESC \ + FOR UPDATE', (sequence_id, True)) for res in cr.dictfetchall(): - if res['condition']: - print "ir_seq: %s has condition:" %res['id'], res['condition'], - try: - bo = safe_eval(res['condition'],context) - if not bo: - print "not matched" - continue - except Exception,e: - # it would be normal to have exceptions, because - # the domain may contain errors - print "Exception.\ne:",e - print "Context:", context - continue - print "Matched!" + if res['condition']: + print "ir_seq: %s has condition:" %res['id'], res['condition'], + try: + bo = safe_eval(res['condition'],context) + if not bo: + print "not matched" + continue + except Exception,e: + # it would be normal to have exceptions, because + # the domain may contain errors + print "Exception.\ne:",e + print "Context:", context + continue + print "Matched!" cr.execute('UPDATE ir_sequence SET number_next=number_next+number_increment WHERE id=%s AND active=%s', (res['id'], True)) if res['number_next']: |
