Hi,
I need to create a new document called Sourcig Request which is a custom doctype on submitting Opportunity. I need it to be created only using server side script. I tried the below but its not working,
def create_sourcing_request(opportunity, row, auto_create=False):
doc = frappe.new_doc(“Sourcing Request”)
doc.update({
‘opportunity’: opportunity.name,
‘customer_name’: opportunity.customer_name,
‘items’: row.items,
})
if auto_create:
doc.flags.ignore_mandatory = True
doc.insert()
frappe.msgprint(_("Sourcing Request {0} created").format(doc.name))
return doc
I am not sure whether this is right and also not sure where to call this function , need help.
Thanks in advance!