[portal] [minor] show status for order and invoice

This commit is contained in:
Anand Doshi
2013-09-12 15:25:38 +05:30
parent 8a4b21ab8e
commit 1be5bb7e6a
9 changed files with 74 additions and 17 deletions

View File

@@ -1 +1,5 @@
{% extends "app/portal/templates/sale.html" %}
{% extends "app/portal/templates/sale.html" %}
{% block status -%}
{% if doc.status %}{{ doc.status }}{% endif %}
{%- endblock %}

View File

@@ -3,14 +3,28 @@
from __future__ import unicode_literals
import webnotes
from webnotes import _
from webnotes.utils import flt, fmt_money
no_cache = True
def get_context():
from portal.utils import get_transaction_context
context = get_transaction_context("Sales Invoice", webnotes.form_dict.name)
modify_status(context.get("doc"))
context.update({
"parent_link": "invoices",
"parent_title": "Invoices"
})
return context
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"))

View File

@@ -11,7 +11,7 @@ def get_context():
context = get_currency_context()
context.update({
"title": "Invoices",
"method": "portal.templates.pages.invoices.get_invoices",
"method": "accounts.doctype.sales_invoice.templates.pages.invoices.get_invoices",
"icon": "icon-file-text",
"empty_list_message": "No Invoices Found",
"page": "invoice"
@@ -21,4 +21,8 @@ def get_context():
@webnotes.whitelist()
def get_invoices(start=0):
from portal.utils import get_transaction_list
return get_transaction_list("Sales Invoice", start)
from accounts.doctype.sales_invoice.templates.pages.invoice import modify_status
invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"])
for d in invoices:
modify_status(d)
return invoices