[ADD] uninstall_hook to remove done activities
This commit is contained in:
parent
437b0e9502
commit
99810d0174
@ -1,2 +1,2 @@
|
||||
from . import models
|
||||
from .hooks import post_load_hook, pre_init_hook
|
||||
from .hooks import post_load_hook, pre_init_hook, uninstall_hook
|
||||
|
@ -16,5 +16,5 @@
|
||||
],
|
||||
"pre_init_hook": "pre_init_hook",
|
||||
"post_load": "post_load_hook",
|
||||
|
||||
'uninstall_hook': 'uninstall_hook',
|
||||
}
|
||||
|
@ -52,3 +52,15 @@ def post_load_hook():
|
||||
if not hasattr(MailActivity, 'action_feedback_original'):
|
||||
MailActivity.action_feedback_original = MailActivity.action_feedback
|
||||
MailActivity.action_feedback = new_action_feedback
|
||||
|
||||
|
||||
def uninstall_hook(cr, registry):
|
||||
""" The objective of this hook is to remove all activities that are done
|
||||
upon module uninstall
|
||||
"""
|
||||
cr.execute(
|
||||
"""
|
||||
DELETE FROM mail_activity
|
||||
WHERE done=True
|
||||
"""
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user