Add call to ModelStorage.delete when changing id of actions

This commit is contained in:
Cédric Krier
2009-08-21 09:12:25 +02:00
parent c85187a104
commit 4ba7214abc
+5 -1
View File
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Action"
from trytond.model import ModelView, ModelSQL, fields
from trytond.model import ModelView, ModelSQL, ModelStorage, fields
from trytond.tools import file_open, Cache
from trytond.backend import TableHandler
import base64
@@ -343,6 +343,7 @@ class ActionReport(ModelSQL, ModelView):
new_id = report.action.id
cursor.execute('UPDATE "' + self._table + '" SET id = %s ' \
'WHERE id = %s', (report.action.id, report.id))
ModelStorage.delete(self, cursor, user, report.id)
self.write(cursor, user, new_id, later, context=context)
return new_id
@@ -446,6 +447,7 @@ class ActionActWindow(ModelSQL, ModelView):
new_id = act_window.action.id
cursor.execute('UPDATE "' + self._table + '" SET id = %s ' \
'WHERE id = %s', (act_window.action.id, act_window.id))
ModelStorage.delete(self, cursor, user, act_window.id)
self.write(cursor, user, new_id, later, context=context)
return new_id
@@ -522,6 +524,7 @@ class ActionWizard(ModelSQL, ModelView):
new_id = wizard.action.id
cursor.execute('UPDATE "' + self._table + '" SET id = %s ' \
'WHERE id = %s', (wizard.action.id, wizard.id))
ModelStorage.delete(self, cursor, user, wizard.id)
self.write(cursor, user, new_id, later, context=context)
return new_id
@@ -667,6 +670,7 @@ class ActionURL(ModelSQL, ModelView):
new_id = url.action.id
cursor.execute('UPDATE "' + self._table + '" SET id = %s ' \
'WHERE id = %s', (url.action.id, url.id))
ModelStorage.delete(self, cursor, user, url.id)
self.write(cursor, user, new_id, later, context=context)
return new_id