blob: 5b55007c7be00436257d31bffd7d2d80bb505ead [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 frappe.utils import flt, fmt_money
8from shopping_cart.templates.utils import get_transaction_context
9
10no_cache = 1
11no_sitemap = 1
12
13def get_context(context):
14 invoice_context = frappe._dict({
15 "parent_link": "invoices",
16 "parent_title": "Invoices"
17 })
18 invoice_context.update(get_transaction_context("Sales Invoice", frappe.form_dict.name))
19 modify_status(invoice_context.doc)
20 return invoice_context
21
22def modify_status(doc):
23 doc.status = ""
24 if flt(doc.outstanding_amount):
25 doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
26 ("label-warning", "icon-exclamation-sign",
27 _("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency))
28 else:
29 doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
30 ("label-success", "icon-ok", _("Paid"))
31