From 2c5ed4adad79a6e1dc91abf49cb55e1fa3f53ce7 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 12 Jul 2010 16:28:59 +0200 Subject: [PATCH] [IMP] account, base_calendar, stock: another round of cr.commit() cleanup. One should never call cr.commit() explicitly unless after having created a dedicated cursor (and you should only do that in very rare cases, if ever). Please let the framework handle the transactions! bzr revid: odo@openerp.com-20100712142859-306guxucojj6q358 --- addons/account/account_move_line.py | 1 - addons/base_calendar/base_calendar.py | 2 -- addons/stock/stock.py | 1 - 3 files changed, 4 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 01a7b60aedd..cc74b2a9158 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -482,7 +482,6 @@ class account_move_line(osv.osv): cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'') if not cr.fetchone(): cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)') - cr.commit() def _check_no_view(self, cr, uid, ids): lines = self.browse(cr, uid, ids) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 85ec16bda8d..f66cd0ca463 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -690,7 +690,6 @@ true, it will allow you to hide the event alarm information without removing it. cr.execute('Update %s set base_calendar_alarm_id=%s, alarm_id=%s \ where id=%s' % (model_obj._table, \ alarm_id, basic_alarm.id, data.id)) - cr.commit() return True def do_alarm_unlink(self, cr, uid, ids, model, context=None): @@ -714,7 +713,6 @@ true, it will allow you to hide the event alarm information without removing it. alarm_obj.unlink(cr, uid, alarm_ids) cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\ where id=%s' % (model_obj._table, datas.id)) - cr.commit() return True res_alarm() diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d44c327b699..21e4fd8ce46 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1451,7 +1451,6 @@ class stock_move(osv.osv): if not cursor.fetchone(): cursor.execute('CREATE INDEX stock_move_location_id_location_dest_id_product_id_state \ ON stock_move (location_id, location_dest_id, product_id, state)') - cursor.commit() return res def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,