fix: add bulk action validation for tags

This commit is contained in:
Gursheen Anand 2026-02-05 17:05:35 +05:30
parent 2146221bee
commit 2605114511
2 changed files with 8 additions and 0 deletions

View file

@ -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:

View file

@ -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])