Lock table when checking for overlap
issue5522 review27431003
This commit is contained in:
1 parent
9cf94c8e69
commit
1624616066
2 files changed
+8
-2
No files matched your search
+4
-1
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user