Fixed update of WatcherObject fields on update

I this changeset, I fixed the issue whereby object auto fields are not
being updated within the WatcherObject after an update.

Change-Id: I7e65341b386a5c0c58c2109348e39e463cf2f668
Closes-Bug: #1641955
This commit is contained in:
Vincent Françoise
2016-11-15 17:19:43 +01:00
parent 3ebe8ab70f
commit 06682fe7c3
16 changed files with 505 additions and 334 deletions

View File

@@ -146,8 +146,9 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
of self.what_changed().
"""
updates = self.obj_get_changes()
self.dbapi.update_action(self.uuid, updates)
db_obj = self.dbapi.update_action(self.uuid, updates)
obj = self._from_db_object(self, db_obj, eager=False)
self.obj_refresh(obj)
self.obj_reset_changes()
@base.remotable
@@ -165,6 +166,9 @@ class Action(base.WatcherPersistentObject, base.WatcherObject,
@base.remotable
def soft_delete(self):
"""Soft Delete the Audit from the DB"""
self.dbapi.soft_delete_action(self.uuid)
self.state = State.DELETED
self.save()
db_obj = self.dbapi.soft_delete_action(self.uuid)
obj = self._from_db_object(
self.__class__(self._context), db_obj, eager=False)
self.obj_refresh(obj)