From bf084536dc0739cc603f5dfee83d72b41724dc66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 10 Sep 2008 17:41:36 +0200 Subject: [PATCH] Handle two kind of sequence one with lock on table (strict) and one without --- trytond/ir/sequence.py | 14 +++++++- trytond/ir/sequence.xml | 71 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/trytond/ir/sequence.py b/trytond/ir/sequence.py index a6468d1b82..e79607f1b7 100644 --- a/trytond/ir/sequence.py +++ b/trytond/ir/sequence.py @@ -72,7 +72,6 @@ class Sequence(OSV): ) def get_id(self, cursor, user, sequence_id, test='id=%s', context=None): - cursor.execute('lock table ir_sequence') cursor.execute('SELECT id, number_next, number_increment, prefix, ' \ 'suffix, padding ' \ 'FROM ir_sequence ' \ @@ -95,3 +94,16 @@ class Sequence(OSV): return self.get_id(cursor, user, code, test='code=%s', context=context) Sequence() + + +class SequenceStrict(Sequence): + "Sequence Strict" + _name = 'ir.sequence.strict' + _description = __doc__ + + def get_id(self, cursor, user, sequence_id, test='id=%s', context=None): + cursor.execute('LOCK TABLE ir_sequence') + return super(SequenceStrict, self).get_id(cursor, user, sequence_id, + test=test, context=context) + +SequenceStrict() diff --git a/trytond/ir/sequence.xml b/trytond/ir/sequence.xml index cf3ae59ff8..c7ede28399 100644 --- a/trytond/ir/sequence.xml +++ b/trytond/ir/sequence.xml @@ -4,6 +4,7 @@ + ir.sequence form @@ -36,7 +37,6 @@ ]]> - ir.sequence @@ -72,6 +72,75 @@ + + + ir.sequence.strict + form + + + + + ir.sequence.strict + tree + + + + + + + ]]> + + + + Sequences Strict + ir.action.act_window + ir.sequence.strict + form + {'active_test': False} + + + + + + + + + + + + + ir.sequence.type form