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.
Hi @Shraddha33 ,
If not enable the server script then enable it in FC.
Then Apply the server script like when submitting your payment entry then update the sales invoice field per remain:
But set your field to allow after submitting for Per remain
for d in doc.get('references'):
test_name = frappe.db.get_value("Sales Invoice",{'name':d.reference_name},'name')
if test_name:
test_doc = frappe.get_doc("Sales Invoice",test_name)
if test_doc.rounded_total == 0:
ā¦
Thanks
NCP
April 27, 2022, 10:05am
#2
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