seitime-frappe/frappe/patches/v11_0/drop_column_apply_user_permissions.py
Ankush Menat 81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30

14 lines
429 B
Python

import frappe
def execute():
column = "apply_user_permissions"
to_remove = ["DocPerm", "Custom DocPerm"]
for doctype in to_remove:
if frappe.db.table_exists(doctype):
if column in frappe.db.get_table_columns(doctype):
frappe.db.sql(f"alter table `tab{doctype}` drop column {column}")
frappe.reload_doc("core", "doctype", "docperm", force=True)
frappe.reload_doc("core", "doctype", "custom_docperm", force=True)