Integrate ERPNext with New Frappe App

Hi,

I am creating a new app for Meter Reading of Water COnsumption. How can I create a function that when I click Invoice button, It will create a new record of Invoice in Invoices.

Thanks,

Jeff

I’ve been working with the version 5
This is my advice
First of all I supposed that you have read the two guide to develop an app in Frappe(which gave me a tinny knowledge of what to do)
So, do this
1- When you click on the Invoice button you have to find in the ajax request which call a whitelist function have been called. Check the param cmd(I can’t tell you at this moment which one it is because I haven’t work with the invoice yet). But let’s assume the function is make_invoice.
2- On your APP go to your hook.py and override the whitelisted function with yours

override_whitelisted_methods = {
    	"frappe.idontknow.make_invoice": "yourapp.make_invoice",
    	}

3- Remember if you have bench in production to restart the supervisor
4- Now you have control of function, you must check what the code do to make the change.

1 Like

Thanks abelbm, I’ll be exploring on that.

I don’t know what you want to do, but my advise is before you override whitelisted methods check if any of the hooks don’t fullfill your need. You have hooks to before_save, after_save on submit, on save and etc.

So check this before!

I think I need to work on with hooks, I’m still new with customizing on
ERPNext… Any good documentation on this?

See the documentation. But i thinks the best way to learn is to see the code:

and:

and:

and:

and finally:

Beste luck.

Hi Jeff, I am interested in your water meter stuff, We intend to use erpnext to bill water consumption.
https://wrmanaivasha.frappecloud.com/
rgds robert

Hi Robert,

We have already done this with another software and we are migrating it to
erpNext. But my team is not yet that equipped with things on ERPNext.

Best to use hooks,

Do walk through the tutorial first:

https://frappe.io/docs/

If you are pushing the invoice from an external app, use the REST API

https://frappe.io/docs/user-guide/rest_api

Hi rmehta,

I will have to create the invoice from an app I have created in Frappe
Bench. I might have to refer this to our python programmer.

Regards,

Jeff

You can directly insert it using the frappe module

frappe.get_doc({
  "doctype": "Sales Invoice", 
  "customer": "xxx"....
  "items": [{"...", ...]
}).insert()

Jeff Bangquil, CPA would like to connect on LinkedIn. How would you like to respond?

Accept: https://www.linkedin.com/blink?simpleRedirect=3gUdjsMcjcMdPkNcjcTcjsUejkZh4BKrSBQonhFtCVF9BlNdkxDm7p5fnBBiShBsC5EsOoVclZMu6lvtCVFfmJB9D9Bp6VFrmlObnhMpmdzoiRybmtSrCBvrmRLoORIrmkZpSVFqSdxsDgCpnhFtCV9pSlipn9Mfm4CujcJrD4SpzBUdSAJejlJtShQbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173147168772096_500&markAsRead=

View Jeff Bangquil, CPA's profile: https://www.linkedin.com/blink?simpleRedirect=0VclZMu6lvtCVFfmJB9D9Bp6VFrmlObnhMpmdzoiRybmtSrCBvrmRLoORIrmkZpSVFqSdxsDgCtD1KfngCujcJrD4SpzBUdSAJejlJtShQbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173147168772096_500&markAsRead=

You are receiving Reminder emails for pending invitations. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=6ZFhj8Bpn1Mon9Cc3gBojxxdzsTpzpxdmgQczBxpmkOemlxczxCejoOdP1BoPp2cylVr71BsA8O9ndPtmdPqmgZr6BxrmkCc3oMc38Zp6ACd3wRdP0NcP0Tdj4NcPsNdPwVdjRAqmsCej5vs7xBnTpKqjRHpipytndKtiRCbmdypmRvrmRLoORIrmkZpSVFqSdxsDgCrSZDfngCujcJrD4SpzBUdSAJejlJtShQbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173147168772096_500&markAsRead=

You received an invitation to connect. LinkedIn will use your email address to make suggestions to our members in features like People You May Know. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=1VcORKsjpCenwTqiQVdmRTp7gJfmhFpiper4NDi4xOmC9gtBhorRp3gRxcgnpPmmZztlkMbl5QdnpPlQ5fmmVydmZlj5hGdPBUtnkOcz59oSFLlllIpCdMqTxaqTh7kltgsl1PrRtPe6p4tkBnsCdoikVijRFypRh3iR16d59DqDxHs7lSu5l1gk5Tgl1gjzAOpmBOuAphgjRAqmZI9zANnT1UplZSrCAZqSkCkjoPp4l7q5p6sCR6kk4ZrClHrRhAqmQCrDlIfngCujcJrD4SpzBUdSAJejlJtShQbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173147168772096_500&markAsRead= Learn why we included this at the following link: https://www.linkedin.com/blink?simpleRedirect=3wUdPgZp4BBr6dFt79x9zANnT1UplZSrCAZqSkCr79lpmdFtD9BkT9BrmZQsTlzfm4CujcJrD4SpzBUdSAJejlJtShQbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173147168772096_500&markAsRead=
© 2015, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA

Jeff Bangquil, CPA would like to connect on LinkedIn. How would you like to respond?

Accept: https://www.linkedin.com/blink?simpleRedirect=30OdjcMe3kScPoNcjcTcjsUejkZh4BKrSBQonhFtCVF9DBRh6lqrQpHfnBBiShBsC5EsOoVclZMu6lvtCVFfmJB9D9Bp6VFrmlObnhMpmdzoiRybmtSrCBvrmRLoORIrmkZpSVFqSdxsDgCpnhFtCV9pSlipn9Mfm4Ct3oJrn8SpzBUdSAJsDgPpzsNbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173146644475904_500&markAsRead=

View Jeff Bangquil, CPA's profile: https://www.linkedin.com/blink?simpleRedirect=0VclZMu6lvtCVFfmJB9D9Bp6VFrmlObnhMpmdzoiRybmtSrCBvrmRLoORIrmkZpSVFqSdxsDgCtD1KfngCt3oJrn8SpzBUdSAJsDgPpzsNbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173146644475904_500&markAsRead=

You are receiving Reminder emails for pending invitations. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=6ZFhj8Bpn1Mon9Cc3gBp31AdmcMc3sOdSoTczAPem8MdzoMoz4Rdj8Tc3kNcjp2cylVr71BsA8O9ndPtmdPqmgZr6BxrmkCc3oMc38Zp6ACc38RcP0UdjoPdz4NcPsNdPwVdjRAqmsCej5vs7xBnTpKqjRHpipytndKtiRCbmdypmRvrmRLoORIrmkZpSVFqSdxsDgCrSZDfngCt3oJrn8SpzBUdSAJsDgPpzsNbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173146644475904_500&markAsRead=

You received an invitation to connect. LinkedIn will use your email address to make suggestions to our members in features like People You May Know. Unsubscribe here: https://www.linkedin.com/blink?simpleRedirect=1QdyRJszpCenwTqiROt3dCdP4JfmhFpipPhApTl5sJpTFmrThqrnBzqB4OcRhlnORncTlFhRBhcR1xgBkMlRhVi6Bzhmh6gDFjkmlgcjwPp4JJrloMrQ5ih55Wd4NBqmkVek95jQhJsT1cpj5Mrl92rTphrDd8e7x3ejl1gR5Nmn9Ss7lSu5l1gk5TpzlOgk9Nl7kMd4phgjRAqmZI9zANnT1UplZSrCAZqSkCkjoPp4l7q5p6sCR6kk4ZrClHrRhAqmQCrDlIfngCt3oJrn8SpzBUdSAJsDgPpzsNbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173146644475904_500&markAsRead= Learn why we included this at the following link: https://www.linkedin.com/blink?simpleRedirect=3wUdPgZp4BBr6dFt79x9zANnT1UplZSrCAZqSkCr79lpmdFtD9BkT9BrmZQsTlzfm4Ct3oJrn8SpzBUdSAJsDgPpzsNbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I5987173146644475904_500&markAsRead=
© 2015, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA