Skip to content

Commit

Permalink
refactor: explicate intent on make_payment_request interface
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Apr 2, 2024
1 parent 8a3accd commit c0e6b01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions erpnext/accounts/doctype/payment_request/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,15 @@ def make_payment_request(**args):
"party_type": args.get("party_type") or "Customer",
"party": args.get("party") or ref_doc.get("customer"),
"bank_account": bank_account,
"make_sales_invoice": args.order_type == "Shopping Cart",
"mute_email": args.mute_email
or args.order_type == "Shopping Cart"
or gateway_account.get("payment_channel", "Email") != "Email",
"make_sales_invoice": (
args.make_sales_invoice # new standard
or args.order_type == "Shopping Cart" # compat for webshop app
),
"mute_email": (
args.mute_email # new standard
or args.order_type == "Shopping Cart" # compat for webshop app
or gateway_account.get("payment_channel", "Email") != "Email"
),
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def test_payment_channels(self):
dt="Sales Order",
dn=so.name,
payment_gateway_account="_Test Gateway - USD", # email channel
order_type = "Shopping Cart",
make_sales_invoice = True,
mute_email = True,
submit_doc=True,
return_doc=True,
)
Expand Down

0 comments on commit c0e6b01

Please sign in to comment.