Follow PEP-0249 for Transaction and backends

issue4949
review19781002
This commit is contained in:
Nicolas Évrard
2016-03-03 21:55:43 +01:00
parent 0d8cdd01c8
commit 3b2e4e1839
+5 -5
View File
@@ -103,17 +103,17 @@ class Forecast(Workflow, ModelSQL, ModelView):
def __register__(cls, module_name):
Location = Pool().get('stock.location')
TableHandler = backend.get('TableHandler')
cursor = Transaction().cursor
cursor = Transaction().connection.cursor()
sql_table = cls.__table__()
table = TableHandler(cursor, cls, module_name)
table = TableHandler(cls, module_name)
migrate_warehouse = (not table.column_exist('warehouse')
and table.column_exist('location'))
super(Forecast, cls).__register__(module_name)
# Add index on create_date
table = TableHandler(cursor, cls, module_name)
table = TableHandler(cls, module_name)
table.index_action('create_date', action='add')
if migrate_warehouse:
@@ -194,7 +194,7 @@ class Forecast(Workflow, ModelSQL, ModelView):
forecast.check_date_overlap()
def check_date_overlap(self):
cursor = Transaction().cursor
cursor = Transaction().connection.cursor()
if self.state != 'done':
return
forcast = self.__table__()
@@ -362,7 +362,7 @@ class ForecastLine(ModelSQL, ModelView):
@classmethod
def get_quantity_executed(cls, lines, name):
cursor = Transaction().cursor
cursor = Transaction().connection.cursor()
pool = Pool()
Move = pool.get('stock.move')
Location = pool.get('stock.location')