Trigger "on submit" event of a doctype

Hi all,
I want to call on submit event of a doctype from another one, is there a way?

I make custom button (Get Item From) in order acceptance doctype. When i click on button then i want to popup two doctypes Quotation and Sales Order. So what i should write javasript for popup that two doctype.
This is code of created custom button using js in order acceptance.

// javascript

// Copyright © 2018, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

cur_frm.pformat.print_heading = ‘Invoice’;

{% include ‘erpnext/selling/sales_common.js’ %};

frappe.ui.form.on(‘Test Order Acceptance’, {
setup: function(frm) {

refresh: function(doc, dt, dn) {
cur_frm.add_custom_button(__('Get From Item'),
	function() {
			method: "erpnext.selling.doctype.quotation.quotation.make_stock_entry",
			source_doctype: "Quotation",
			get_query_filters: {
				docstatus: 1,
				status: ["!=", "Lost"],
				order_type: cur_frm.doc.order_type,
				customer: cur_frm.doc.customer || undefined,


thanks @Divyesh_Kanzariya
But I just want to trigger the submit event of a doctype in another python script

Hi @MaysaaSafadi
You can use the following

doc = frappe.get_doc("Doctype", record_name)
1 Like

Yes I used it now, it works fine :slight_smile:
Thanks @ManasSolanki

I want to copy specific fields values of one doctype to other doctype on submit/save button of doctype.
any help?

In the submit function in the source doctype, you can call the other doctype doc and update the field value you want, like here

Thanks for the reply…

will it work on save button?

Run it in on_validate function in order to work on save btn

Okay. Thank you