diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index 101c5ae35..3986a12a3 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -175,7 +175,12 @@ def share_with_agent(self, agent): flags={"ignore_share_permission": True}, ) elif user != agent: - frappe.share.remove(self.doctype, self.name, user) + frappe.share.remove( + self.doctype, + self.name, + user, + flags={"ignore_share_permission": True, "ignore_permissions": True}, + ) def set_sla(self): """ diff --git a/crm/fcrm/doctype/crm_lead/crm_lead.py b/crm/fcrm/doctype/crm_lead/crm_lead.py index e3fc779ed..dba47b690 100644 --- a/crm/fcrm/doctype/crm_lead/crm_lead.py +++ b/crm/fcrm/doctype/crm_lead/crm_lead.py @@ -141,7 +141,7 @@ def assign_agent(self, agent): # the agent is already set as an assignee return - assign({"assign_to": [agent], "doctype": "CRM Lead", "name": self.name}) + assign({"assign_to": [agent], "doctype": "CRM Lead", "name": self.name}, ignore_permissions=True) def share_with_agent(self, agent): if not agent: @@ -168,7 +168,12 @@ def share_with_agent(self, agent): flags={"ignore_share_permission": True}, ) elif user != agent: - frappe.share.remove(self.doctype, self.name, user) + frappe.share.remove( + self.doctype, + self.name, + user, + flags={"ignore_share_permission": True, "ignore_permissions": True}, + ) def create_contact(self, existing_contact=None, throw=True): if not self.lead_name: