ERPNext extension

Hi all,

Please help, I am learning how to build an extension on ERPNext, i was hoping to use from my custom app for custom calculations. Steps that I took was:

  • Create an application using bench new-app mylearning

  • I use existing erpnext site which is site1.local as target installation site, so i use bench --site site1.local install-app mylearning

  • I modify the under frappe-bench/apps/mylearning/mylearning and add

      doc_events = {
      "User": {
               "after_save": "mylearning.api.printmessage"
  • I create under the same location as above with a simple print program

    from frappe import msgprint


    def printmessage(doc, method):
    msgprint(_(“Inside api 2”))

  • I test this by updating an existing user and click save button, but nothing happened.

What did I do wrong?

check your bench log, the terminal screen where you did bench start for errors.

use frappe.msgprint("message") instead of msgprint("message")

Hi Revant,

It’s working now, I add erpnext in requirement.txt… and restart bench. Not sure if that is the root cause.