Update form from another form how?

I trying to develop same functionality Between “Time Log Batched and Sale Invoice” in our custom forms.
when time log batch is Batched for invoicing then its status change from draft to Batched for billing and when invoice is create then status of TIme log batch change from Batched for billing to billed. may be now is more clear.

thanks
Baljeet Singh

Take a look at this PR: https://github.com/frappe/erpnext/pull/5459/files

In quotation.py you can see the method to update the status of Lead through the status_updater controller. You can extend the same functionality to whichever doctype you choose through that controller (or a custom one)!

Let me know if you need more help, this is a good starting point for you though.

@alec_ruizramon1 Thanks for the reply . and appreciate for your interest.

@alec_ruizramon1: Its not clear to me, have any another way to do this like custom script. ?

You can also hook into the functionality and run a method to set the value on the other form. The advantage is that it’s easier, the disadvantage is that it isn’t called from the doc (as a class function) so you must remember to keep track of an additional place where a property is set ( = higher maintenance).

In hooks.py in your custom app:

doc_events = {
    "Doc you are getting value from": {
        "method_you_want_to_hook_into": "path_to_file_with_method.method_name"
    }
}

In the file that you used above:

method_name(doc, method): #hooks passes two arguments: the doc, and the name of the method
    #logic here to determine what value to set, and then maybe
    frappe.client.set_value("Doctype you want to change", "Docname you want to change", "fieldname", "value")

Hope this helps!