blob: 832a60e1d5a38b3befcef5ef108e27b1a62e23ca [file] [log] [blame]
Rushabh Mehta3daa49a2014-10-21 16:16:30 +05301# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
2# License: GNU General Public License v3. See license.txt
3
4from __future__ import unicode_literals
5import frappe
6from frappe import _
7from shopping_cart.templates.utils import get_transaction_context
8
9no_cache = 1
10no_sitemap = 1
11
12def get_context(context):
13 order_context = frappe._dict({
14 "parent_link": "orders",
15 "parent_title": "My Orders"
16 })
17
18 order_context.update(get_transaction_context("Sales Order", frappe.form_dict.name))
19 modify_status(order_context.doc)
20 return order_context
21
22def modify_status(doc):
23 doc.status = []
24 if 0 < doc.per_billed < 100:
25 doc.status.append(("label-warning", "icon-ok", _("Partially Billed")))
26 elif doc.per_billed == 100:
27 doc.status.append(("label-success", "icon-ok", _("Billed")))
28
29 if 0 < doc.per_delivered < 100:
30 doc.status.append(("label-warning", "icon-truck", _("Partially Delivered")))
31 elif doc.per_delivered == 100:
32 doc.status.append(("label-success", "icon-truck", _("Delivered")))
33 doc.status = " " + " ".join(('<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % s
34 for s in doc.status))