fix: Remove advance_payment_status uses
(cherry picked from commit 907e3af1b0)
This commit is contained in:
committed by
Mergify
parent
ef52be2f17
commit
36b4f68566
@@ -1846,37 +1846,6 @@ class AccountsController(TransactionBase):
|
||||
|
||||
self.db_set("advance_paid", advance_paid)
|
||||
|
||||
self.set_advance_payment_status()
|
||||
|
||||
def set_advance_payment_status(self):
|
||||
new_status = None
|
||||
|
||||
paid_amount = frappe.get_value(
|
||||
doctype="Payment Request",
|
||||
filters={
|
||||
"reference_doctype": self.doctype,
|
||||
"reference_name": self.name,
|
||||
"docstatus": 1,
|
||||
},
|
||||
fieldname="sum(grand_total - outstanding_amount)",
|
||||
)
|
||||
|
||||
if not paid_amount:
|
||||
if self.doctype in frappe.get_hooks("advance_payment_receivable_doctypes"):
|
||||
new_status = "Not Requested" if paid_amount is None else "Requested"
|
||||
elif self.doctype in frappe.get_hooks("advance_payment_payable_doctypes"):
|
||||
new_status = "Not Initiated" if paid_amount is None else "Initiated"
|
||||
else:
|
||||
total_amount = self.get("rounded_total") or self.get("grand_total")
|
||||
new_status = "Fully Paid" if paid_amount == total_amount else "Partially Paid"
|
||||
|
||||
if new_status == self.advance_payment_status:
|
||||
return
|
||||
|
||||
self.db_set("advance_payment_status", new_status, update_modified=False)
|
||||
self.set_status(update=True)
|
||||
self.notify_update()
|
||||
|
||||
@property
|
||||
def company_abbr(self):
|
||||
if not hasattr(self, "_abbr"):
|
||||
|
||||
Reference in New Issue
Block a user