fix(pr): set adv. pay. status for po (still fails; differently)

This commit is contained in:
David
2024-04-02 19:31:07 +02:00
parent bcdfbee23e
commit c705a393fe

View File

@@ -152,32 +152,32 @@ class PaymentRequest(Document):
def on_submit(self): def on_submit(self):
if self.payment_request_type == "Outward": if self.payment_request_type == "Outward":
self.db_set("status", "Initiated") self.db_set("status", "Initiated")
return
elif self.payment_request_type == "Inward": elif self.payment_request_type == "Inward":
self.db_set("status", "Requested") self.db_set("status", "Requested")
send_mail = self.payment_gateway_validation() if self.payment_gateway else None if self.payment_request_type == "Inward":
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name) send_mail = self.payment_gateway_validation() if self.payment_gateway else None
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
if ( if (
hasattr(ref_doc, "order_type") and ref_doc.order_type == "Shopping Cart" hasattr(ref_doc, "order_type") and ref_doc.order_type == "Shopping Cart"
) or self.flags.mute_email: ) or self.flags.mute_email:
send_mail = False send_mail = False
if send_mail and self.payment_channel != "Phone": if send_mail and self.payment_channel != "Phone":
self.set_payment_request_url() self.set_payment_request_url()
self.send_email() self.send_email()
self.make_communication_entry() self.make_communication_entry()
elif self.payment_channel == "Phone": elif self.payment_channel == "Phone":
self.request_phone_payment() self.request_phone_payment()
advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks( advance_payment_doctypes = frappe.get_hooks("advance_payment_receivable_doctypes") + frappe.get_hooks(
"advance_payment_payable_doctypes" "advance_payment_payable_doctypes"
) )
if self.reference_doctype in advance_payment_doctypes: if self.reference_doctype in advance_payment_doctypes:
# set advance payment status # set advance payment status
ref_doc.set_total_advance_paid() ref_doc.set_total_advance_paid()
def request_phone_payment(self): def request_phone_payment(self):
controller = _get_payment_gateway_controller(self.payment_gateway) controller = _get_payment_gateway_controller(self.payment_gateway)