Payment Confirmation Email Alert

Hello,
I want an email alert to be sent to customer as soon as we have did a payment entry, I have try with document type: Payment Entry with no success, when i try with document type: Sales Invoice it’s work perfect when the condition: doc.status=="Unpaid" but when change the condition: doc.status=="Paid" which is must be it’s not working, for more details i have attached screenshot of both

1 Like

Any one experience such issue?

replicating. @makarand_b can you please check into it?

@mayar,

Thanks for reporting the issue, This issue has been fix.

Please check [hook] added before_change hook to trigger email_alerts before db_set by mbauskar · Pull Request #2844 · frappe/frappe · GitHub

Thanks,
Makarand

1 Like

@makarand_b & @umair
I have updated my bench but still same issue did you push the update or should i manually do it?

Thanks,
Sherwali

This pull request is not yet merged. You can expect it in the update after it is merged, mostly next week.

1 Like

Still it’s not working, now I’m in version:
ERPNext: v8.0.15 (master)
Frappe Framework: v8.0.19 (master)

@mayar

I wanted to do exactly same thing, but I solved it by sending Payment Receipt from payment entry.

Added Custom heading on payment entry “Payment Receipt” for receive type, and “Payment Advise” for pay.

Added custom fields for contact link & contact email id on payment entry. On submit event created email alert which sends custom mail using “remark” field of payment entry along with “Payment Receipt” PDF.

@Mukesh_Variyani
Can please share more details or if possible screenshot?

Add Contact Person (Link to Doctype Contacts) & Email Id field in payment entry.

Added Custom heading on payment entry “Payment Receipt” for receive type, and “Payment Advise” for pay.

To auto set print heading based on payment type can use below custom script

frappe.ui.form.on('Payment Entry', 'payment_type', function(frm){
    if(frm.party_type == "Pay"){
			frm.set_value('print_heading', "Payment Advice");
		}
});

frappe.ui.form.on('Payment Entry', 'payment_type', function(frm){
    if(frm.party_type == "Receive"){
			frm.set_value('print_heading', "Payment Receipt");
		}
});

Define Email Alert as below:

Email alert message can be:

<p>
	Dear Sir,
</p>
<p>
	Thank you very much for payment of {{ doc.remarks.replace('\n', "<br>") }}.
<p>
	Please have payment receipt as attached.
</p>
<p>
	Thanks &amp; Regards,

@Mukesh_Variyani

Thank you very much, it works perfect, only custom script which auto set print heading was not worked for me.

It will work only when part is selected on payment entry form, if its selected on onload (ie. if payment entry is being made from invoice) you need to set it on onload event like below. I have kept it default as "Payment Receipt, and changing it onload if pyment type is “Pay”

frappe.ui.form.on('Payment Entry', 'onload', function(frm){
    if(frm.doc.__islocal && frm.doc.payment_type== "Pay"){
			frm.set_value('print_heading', "Payment Advice");
		}
});

@Mukesh_Variyani

A very big thanks, now it’s worked.

1 Like