Lock table when checking for overlap

issue5522
review27431003
This commit is contained in:
Cédric Krier committed 2016-07-07 10:06:50 +02:00
1 parent 9cf94c8e69
commit 1624616066
2 files changed
+8 -2

No files matched your search

+4 -1
View File
@@ -105,7 +105,10 @@ class FiscalYear(ModelSQL, ModelView):
year.check_post_move_sequence()
def check_dates(self):
cursor = Transaction().connection.cursor()
transaction = Transaction()
connection = transaction.connection
transaction.database.lock(connection, self._table)
cursor = connection.cursor()
table = self.__table__()
cursor.execute(*table.select(table.id,
where=(((table.start_date <= self.start_date)
+4 -1
View File
@@ -113,10 +113,13 @@ class Period(ModelSQL, ModelView):
period.check_post_move_sequence()
def check_dates(self):
cursor = Transaction().connection.cursor()
if self.type != 'standard':
return True
transaction = Transaction()
connection = transaction.connection
transaction.database.lock(connection, self._table)
table = self.__table__()
cursor = connection.cursor()
cursor.execute(*table.select(table.id,
where=(((table.start_date <= self.start_date)
& (table.end_date >= self.start_date))