fix: ignore share permission while sharing doc with approver

This commit is contained in:
Rucha Mahabal 2021-04-04 18:45:06 +05:30
parent 13c0a350af
commit 8c055b5469

View File

@ -508,7 +508,9 @@ def grant_leaves_automatically():
def share_doc_with_approver(doc, user):
# if approver does not have permissions, share
if not frappe.has_permission(doc=doc, ptype="submit", user=user):
frappe.share.add(doc.doctype, doc.name, user, submit=1)
frappe.share.add(doc.doctype, doc.name, user, submit=1,
flags={"ignore_share_permission": True})
frappe.msgprint(_("Shared with the user {0} with {1} access").format(
user, frappe.bold("submit"), alert=True))