Closed cogk closed 1 month ago
I confirm. The same issue occurs when adding payment request from Webshop
@cogk Could you provide replication steps?
@cogk Could you provide replication steps?
Login as a customer. Using webshop add something in cart. Set up to use PayPal as payment engine. Press button "Pay Now" on the created Sales Order. You get below:
Above image is from test but same occurs on live site.
Full test case:
import frappe
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
frappe.set_user("Guest")
so_name = frappe.db.get_value("Sales Order", {})
make_payment_request(dt="Sales Order", dn=so_name, submit_doc=True)
raises PermissionError
@ruthra-kumar
@ruthra-kumar The problem can be temporary solved by changing in Account Settings the Payment Request save in draft status.
The root of the problem is on doctype payment_request.py that it tries to submit without first insert.
if frappe.db.get_single_value("Accounts Settings", "create_pr_in_draft_status", cache=True): pr.insert(ignore_permissions=True) if args.submit_doc: pr.submit()
it tries to submit without first insert
The root problem is that the doc.flags.ignore_permissions
is not set to True anymore in all paths, but it must be because the method is whitelisted and accesible for Guest
@cogk @phalouvas https://github.com/frappe/erpnext/pull/43146 should fix this.
Information about bug
If
create_pr_in_draft_status
is no which is the default, theignore_permissions
flag is not set on the PR, making it impossible for Guest to submit it.https://github.com/frappe/erpnext/blob/ca2fde891ec32b162f6b6c33d9ff10b60e4ca57c/erpnext/accounts/doctype/payment_request/payment_request.py#L528-L531
Module
selling, ecommerce
Version
erpnext 15.33.5 frappe 15.39.0 hrms 15.27.0 insights 2.2.4 payments
Installation method
manual install
Relevant log output / Stack trace / Full Error Message.