Skip to content

Commit

Permalink
Improvise and fix indicators in Portal list
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashah115 committed Oct 2, 2018
1 parent 90cf2dd commit abb8b38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe, erpnext
import frappe.defaults
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr
from frappe.utils import cint, flt, add_months, today, date_diff, getdate, add_days, cstr, nowdate
from frappe import _, msgprint, throw
from erpnext.accounts.party import get_party_account, get_due_date
from erpnext.controllers.stock_controller import update_gl_entries_after
Expand Down Expand Up @@ -54,9 +54,18 @@ def __init__(self, *args, **kwargs):

def set_indicator(self):
"""Set indicator for portal"""
if self.outstanding_amount > 0:
if cint(self.is_return) == 1:
self.indicator_title = _("Return")
self.indicator_color = "darkgrey"
elif self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()):
self.indicator_color = "orange"
self.indicator_title = _("Unpaid")
elif self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()):
self.indicator_color = "red"
self.indicator_title = _("Overdue")
elif self.outstanding_amount < 0:
self.indicator_title = _("Credit Note Issued")
self.indicator_color = "darkgrey"
else:
self.indicator_color = "green"
self.indicator_title = _("Paid")
Expand Down
3 changes: 2 additions & 1 deletion erpnext/templates/pages/order.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ <h1>{{ doc.name }}</h1>

<div class="row transaction-subheading">
<div class="col-xs-6">

<span class="indicator {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{{ _(doc.indicator_title) or _(doc.status) or _("Submitted") }}
{{ _(doc.get('indicator_title')) or _(doc.status) or _("Submitted") }}
</span>
</div>
<div class="col-xs-6 text-muted text-right small">
Expand Down

0 comments on commit abb8b38

Please sign in to comment.