How to Create Progress bar In Sales Invoice by using Server script with Journal Entry

Hello @NCP ,
Continuing Last discussion with progress bar,
we create server script using Reference Document Type
ā†’ Payment Entry but we also used journal Entry.

Then how to write script for same issue as link provided below but using reference doctype as Journal Entry. 

Thanks

Hi @Shraddha33,

Please apply Server Script and check it.

Reference Document Type: Journal Entry
DocType Event: After Submit

for d in doc.get('accounts'):
    ref_name = frappe.db.get_value("Sales Invoice",{'name':d.reference_name},'name')
    if ref_name:
        inv_doc = frappe.get_doc("Sales Invoice",ref_name)
        if inv_doc.rounded_total == 0:
            inv_doc.remain = (inv_doc.outstanding_amount * 100) / inv_doc.grand_total
        else:
            inv_doc.remain = (inv_doc.outstanding_amount * 100) / inv_doc.rounded_total
        inv_doc.save()

Thank You!

1 Like

Hello @NCP ,
Yes its work
Thank You :slight_smile: