Try ERPNext Buy Support Partners Foundation

Auto share with

Dears

Because of security so we use option like

share with

for example i need when a user make a new LEAD

this lead is automatically Shared With Aspecific person

how can i achive the automatic sharewith without let the user to press share with and choose from the list ?

@sheno,

You will need to write a server / client script to achieve the auto share functionality. On documents validate method you can share the document with a specific user.

To share the document you can use the add method.

e.g.
server script

from frappe.share import add
add(doc.doctype, doc.name, user, read, write, share, everyone)

client script

frappe.call({
	method: "frappe.share.call",
	args: {
		doctype: "Lead",
		name: "Lead-00001",
		user: "user name"
		read: 1,
		write: 1,
		share: 0,
		everyone: 0
	},
	callback(r) {
		if(r.message) {
			// document is shared with user
		}
	}
})

Thanks,
Makarand

Can I make this script as Custom Script!