Fix success url

This commit is contained in:
Faris Ansari
2017-08-23 19:20:28 +05:30
parent f05f53a0f0
commit 841ddbd064
3 changed files with 11 additions and 8 deletions

View File

@@ -47,7 +47,7 @@
<script> <script>
frappe.ready(function() { frappe.ready(function() {
$('[data-action="primary"]').click(function() { $('[data-action="primary"]').click(function() {
var url = "/bounty/back-this-bounty?bounty_name={{doc.name}}&user=" + frappe.session.user; var url = "/back-this-bounty?bounty_name={{doc.name}}&user=" + frappe.session.user;
var amount = $('[data-field="amount"]').val(); var amount = $('[data-field="amount"]').val();
if(amount > 0) { if(amount > 0) {
url += '&amount=' + amount; url += '&amount=' + amount;

View File

@@ -15,9 +15,12 @@ class BountyBacker(Document):
doc = frappe.get_doc('Bounty', self.bounty_name) doc = frappe.get_doc('Bounty', self.bounty_name)
self.idx = len(doc.bounty_backer) self.idx = len(doc.bounty_backer)
def on_payment_authorized(self, *args, **kwargs): def on_payment_authorized(self, status_changed_to=None):
if status_changed_to in ("Completed", "Authorized"):
self.db_set('paid', 1) self.db_set('paid', 1)
# to trigger form events of Bounty doctype # to trigger form events of Bounty doctype
doc = frappe.get_doc('Bounty', self.bounty_name) doc = frappe.get_doc('Bounty', self.bounty_name)
doc.save() doc.save()
return '/' + doc.route
return '/bounties'

View File

@@ -19,7 +19,7 @@
"is_standard": 1, "is_standard": 1,
"login_required": 1, "login_required": 1,
"max_attachment_size": 0, "max_attachment_size": 0,
"modified": "2017-08-23 18:05:50.695856", "modified": "2017-08-23 18:21:28.733120",
"modified_by": "faris@erpnext.com", "modified_by": "faris@erpnext.com",
"module": "ERPNext Foundation", "module": "ERPNext Foundation",
"name": "back-this-bounty", "name": "back-this-bounty",
@@ -27,7 +27,7 @@
"payment_button_label": "Pay now", "payment_button_label": "Pay now",
"payment_gateway": "Razorpay", "payment_gateway": "Razorpay",
"published": 1, "published": 1,
"route": "bounty/back-this-bounty", "route": "back-this-bounty",
"show_sidebar": 1, "show_sidebar": 1,
"sidebar_items": [], "sidebar_items": [],
"success_url": "/bounties", "success_url": "/bounties",