diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index d73f33d716fbd9b366160df30afa7f3f78024125..b79020c595a201f1de084e5797d24c9705758629 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -521,6 +521,8 @@ def reconcile_against_document( entry.party, ) + doc.run_method("update_advance_paid") # @dokos + frappe.flags.ignore_party_validation = False @@ -606,12 +608,13 @@ def update_reference_in_journal_entry(d, journal_entry, do_not_save=False): """ jv_detail = journal_entry.get("accounts", {"name": d["voucher_detail_no"]})[0] + # @dokos # Update Advance Paid in SO/PO since they might be getting unlinked - advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks( - "advance_payment_payable_doctypes" - ) - if jv_detail.get("reference_type") in advance_payment_doctypes: - frappe.get_doc(jv_detail.reference_type, jv_detail.reference_name).set_total_advance_paid() + # advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks( + # "advance_payment_payable_doctypes" + # ) + # if jv_detail.get("reference_type") in advance_payment_doctypes: + # frappe.get_doc(jv_detail.reference_type, jv_detail.reference_name).set_total_advance_paid() if flt(d["unadjusted_amount"]) - flt(d["allocated_amount"]) != 0: # adjust the unreconciled balance @@ -683,14 +686,15 @@ def update_reference_in_payment_entry( if d.voucher_detail_no: existing_row = payment_entry.get("references", {"name": d["voucher_detail_no"]})[0] + # @dokos # Update Advance Paid in SO/PO since they are getting unlinked - advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks( - "advance_payment_payable_doctypes" - ) - if existing_row.get("reference_doctype") in advance_payment_doctypes: - frappe.get_doc( - existing_row.reference_doctype, existing_row.reference_name - ).set_total_advance_paid() + # advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks( + # "advance_payment_payable_doctypes" + # ) + # if existing_row.get("reference_doctype") in advance_payment_doctypes: + # frappe.get_doc( + # existing_row.reference_doctype, existing_row.reference_name + # ).set_total_advance_paid() if d.allocated_amount <= existing_row.allocated_amount: existing_row.allocated_amount -= d.allocated_amount