fix: add bulk action validation for tags
This commit is contained in:
parent
2146221bee
commit
2605114511
2 changed files with 8 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
# License: MIT. See LICENSE
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.query_builder import DocType
|
||||
from frappe.utils import unique
|
||||
|
|
@ -43,6 +44,10 @@ def add_tag(tag, dt, dn, color=None):
|
|||
@frappe.whitelist()
|
||||
def add_tags(tags, dt, docs, color=None):
|
||||
"adds a new tag to a record, and creates the Tag master"
|
||||
|
||||
if not frappe.get_cached_value("User", frappe.session.user, "bulk_actions"):
|
||||
frappe.throw(_("You are not allowed to perform bulk actions"), frappe.PermissionError)
|
||||
|
||||
tags = frappe.parse_json(tags)
|
||||
docs = frappe.parse_json(docs)
|
||||
for doc in docs:
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ def download_multi_pdf_async(
|
|||
"""
|
||||
Calls _download_multi_pdf with the given parameters in a background job, returns task ID
|
||||
"""
|
||||
if not frappe.get_cached_value("User", frappe.session.user, "bulk_actions"):
|
||||
frappe.throw(_("You are not allowed to perform bulk actions"), frappe.PermissionError)
|
||||
|
||||
task_id = str(uuid.uuid4())
|
||||
if isinstance(doctype, dict):
|
||||
doc_count = sum([len(doctype[dt]) for dt in doctype])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue