1
0
forked from test/crm
jcrm/crm/uninstall.py

24 lines
564 B
Python

# Copyright (c) 2022, JINGROW and Contributors
# MIT License. See license.txt
import click
import jingrow
def before_uninstall():
delete_email_template_custom_fields()
def delete_email_template_custom_fields():
if jingrow.get_meta("Email Template").has_field("enabled"):
click.secho("* Uninstalling Custom Fields from Email Template")
fieldnames = (
"enabled",
"reference_pagetype",
)
for fieldname in fieldnames:
jingrow.db.delete("Custom Field", {"name": "Email Template-" + fieldname})
jingrow.clear_cache(pagetype="Email Template")