mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
[portal] [minor] show status for order and invoice
This commit is contained in:
@@ -1 +1,5 @@
|
||||
{% extends "app/portal/templates/sale.html" %}
|
||||
{% extends "app/portal/templates/sale.html" %}
|
||||
|
||||
{% block status -%}
|
||||
{% if doc.status %}{{ doc.status }}{% endif %}
|
||||
{%- endblock %}
|
||||
@@ -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"))
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user