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>
frappe.ready(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();
if(amount > 0) {
url += '&amount=' + amount;

View File

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

View File

@@ -19,7 +19,7 @@
"is_standard": 1,
"login_required": 1,
"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",
"module": "ERPNext Foundation",
"name": "back-this-bounty",
@@ -27,7 +27,7 @@
"payment_button_label": "Pay now",
"payment_gateway": "Razorpay",
"published": 1,
"route": "bounty/back-this-bounty",
"route": "back-this-bounty",
"show_sidebar": 1,
"sidebar_items": [],
"success_url": "/bounties",