mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +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,30 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _
|
||||
|
||||
no_cache = True
|
||||
|
||||
def get_context():
|
||||
from portal.utils import get_transaction_context
|
||||
context = get_transaction_context("Sales Order", webnotes.form_dict.name)
|
||||
modify_status(context.get("doc"))
|
||||
context.update({
|
||||
"parent_link": "orders",
|
||||
"parent_title": "My Orders"
|
||||
})
|
||||
return context
|
||||
return context
|
||||
|
||||
def modify_status(doc):
|
||||
doc.status = []
|
||||
if 0 < doc.per_billed < 100:
|
||||
doc.status.append(("label-warning", "icon-ok", _("Partially Billed")))
|
||||
elif doc.per_billed == 100:
|
||||
doc.status.append(("label-success", "icon-ok", _("Billed")))
|
||||
|
||||
if 0 < doc.per_delivered < 100:
|
||||
doc.status.append(("label-warning", "icon-truck", _("Partially Delivered")))
|
||||
elif doc.per_delivered == 100:
|
||||
doc.status.append(("label-success", "icon-truck", _("Delivered")))
|
||||
doc.status = " " + " ".join(('<span class="label %s"><i class="icon-fixed-width %s"></i> %s</span>' % s
|
||||
for s in doc.status))
|
||||
|
||||
@@ -11,7 +11,7 @@ def get_context():
|
||||
context = get_currency_context()
|
||||
context.update({
|
||||
"title": "My Orders",
|
||||
"method": "portal.templates.pages.orders.get_orders",
|
||||
"method": "selling.doctype.sales_order.templates.pages.orders.get_orders",
|
||||
"icon": "icon-list",
|
||||
"empty_list_message": "No Orders Yet",
|
||||
"page": "order",
|
||||
@@ -21,5 +21,10 @@ def get_context():
|
||||
@webnotes.whitelist()
|
||||
def get_orders(start=0):
|
||||
from portal.utils import get_transaction_list
|
||||
return get_transaction_list("Sales Order", start)
|
||||
from selling.doctype.sales_order.templates.pages.order import modify_status
|
||||
orders = get_transaction_list("Sales Order", start, ["per_billed", "per_delivered"])
|
||||
for d in orders:
|
||||
modify_status(d)
|
||||
|
||||
return orders
|
||||
|
||||
Reference in New Issue
Block a user