Rushabh Mehta | 156ce60 | 2015-09-11 18:49:59 +0530 | [diff] [blame] | 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors |
| 2 | # License: GNU General Public License v3. See license.txt |
| 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | import frappe |
| 6 | |
| 7 | from frappe import _ |
| 8 | |
| 9 | def get_context(context): |
| 10 | context.no_cache = 1 |
Kanchan Chauhan | 11638ba | 2016-04-20 16:20:49 +0530 | [diff] [blame] | 11 | context.show_sidebar = True |
Rushabh Mehta | 156ce60 | 2015-09-11 18:49:59 +0530 | [diff] [blame] | 12 | context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name) |
Rushabh Mehta | 3d76686 | 2015-09-16 18:52:52 +0530 | [diff] [blame] | 13 | if hasattr(context.doc, "set_indicator"): |
| 14 | context.doc.set_indicator() |
| 15 | |
Rushabh Mehta | 156ce60 | 2015-09-11 18:49:59 +0530 | [diff] [blame] | 16 | context.parents = frappe.form_dict.parents |
Rushabh Mehta | 257bbbe | 2016-10-12 10:31:08 +0530 | [diff] [blame] | 17 | context.payment_ref = frappe.db.get_value("Payment Request", |
Saurabh | 0a0c787 | 2016-01-04 17:37:54 +0530 | [diff] [blame] | 18 | {"reference_name": frappe.form_dict.name}, "name") |
Rohit Waghchaure | 21499e8 | 2016-09-21 16:49:58 +0530 | [diff] [blame] | 19 | |
Saurabh | 883cc04 | 2016-01-21 15:43:07 +0530 | [diff] [blame] | 20 | context.enabled_checkout = frappe.get_doc("Shopping Cart Settings").enable_checkout |
Rohit Waghchaure | 21499e8 | 2016-09-21 16:49:58 +0530 | [diff] [blame] | 21 | |
Rushabh Mehta | 257bbbe | 2016-10-12 10:31:08 +0530 | [diff] [blame] | 22 | if not frappe.has_website_permission(context.doc): |
Rushabh Mehta | 156ce60 | 2015-09-11 18:49:59 +0530 | [diff] [blame] | 23 | frappe.throw(_("Not Permitted"), frappe.PermissionError) |