2013-11-20 07:29:58 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-09-10 08:16:15 +00:00
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import webnotes
|
2013-09-12 09:55:38 +00:00
|
|
|
from webnotes import _
|
|
|
|
from webnotes.utils import flt, fmt_money
|
2013-09-10 08:16:15 +00:00
|
|
|
|
2013-09-10 12:59:39 +00:00
|
|
|
no_cache = True
|
|
|
|
|
2013-09-10 08:16:15 +00:00
|
|
|
def get_context():
|
2013-12-25 09:49:22 +00:00
|
|
|
from erpnext.templates.utils import get_transaction_context
|
2013-09-10 08:16:15 +00:00
|
|
|
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
|
2013-09-12 09:55:38 +00:00
|
|
|
modify_status(context.get("doc"))
|
2013-09-10 08:16:15 +00:00
|
|
|
context.update({
|
|
|
|
"parent_link": "invoices",
|
|
|
|
"parent_title": "Invoices"
|
|
|
|
})
|
2013-09-12 09:55:38 +00:00
|
|
|
return context
|
|
|
|
|
|
|
|
def modify_status(doc):
|
|
|
|
doc.status = ""
|
|
|
|
if flt(doc.outstanding_amount):
|
|
|
|
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
|
|
|
("label-warning", "icon-exclamation-sign",
|
|
|
|
_("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency))
|
|
|
|
else:
|
|
|
|
doc.status = '<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % \
|
|
|
|
("label-success", "icon-ok", _("Paid"))
|
|
|
|
|