[portal] [minor] show status for order and invoice
diff --git a/portal/templates/sale.html b/portal/templates/sale.html
index 41ba297..2a7c603 100644
--- a/portal/templates/sale.html
+++ b/portal/templates/sale.html
@@ -17,7 +17,7 @@
<div>
<div class="row">
<div class="col-xs-6">
- {% if doc.status -%}<div class="label label-default">{{ doc.status }}</div>{%- endif %}
+ {% block status -%}{%- endblock %}
</div>
<div class="col-xs-6">
<span class="pull-right">{{ utils.formatdate(doc.posting_date or doc.transaction_date) }}</span>
diff --git a/portal/templates/sales_transactions.html b/portal/templates/sales_transactions.html
index 10139c3..5f33797 100644
--- a/portal/templates/sales_transactions.html
+++ b/portal/templates/sales_transactions.html
@@ -12,12 +12,14 @@
<script>
var render = function(doc) {
doc.grand_total_export = format_currency(doc.grand_total_export, doc.currency);
-
+ if(!doc.status) doc.status = "";
+
$(repl('<a href="{{ page }}?name=%(name)s" class="list-group-item">\
<div class="row">\
<div class="col-md-6">\
<div class="row col-md-12">%(name)s</div>\
- <div class="row col-md-12 text-muted">%(items)s...</div>\
+ <div class="row col-md-12 text-muted">%(items)s</div>\
+ <div class="row col-md-12">%(status)s</div>\
</div>\
<div class="col-md-3 text-right">%(grand_total_export)s</div>\
<div class="col-md-3 text-right text-muted">%(creation)s</div>\
diff --git a/portal/utils.py b/portal/utils.py
index 25da39c..8f42d9b 100644
--- a/portal/utils.py
+++ b/portal/utils.py
@@ -6,19 +6,27 @@
from webnotes.utils import cint, formatdate
import json
-def get_transaction_list(doctype, start):
+def get_transaction_list(doctype, start, additional_fields=None):
# find customer id
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
"customer")
-
+
if customer:
- transactions = webnotes.conn.sql("""select name, creation, currency, grand_total_export
+ if additional_fields:
+ additional_fields = ", " + ", ".join(("`%s`" % f for f in additional_fields))
+ else:
+ additional_fields = ""
+
+ transactions = webnotes.conn.sql("""select name, creation, currency, grand_total_export
+ %s
from `tab%s` where customer=%s and docstatus=1
order by creation desc
- limit %s, 20""" % (doctype, "%s", "%s"), (customer, cint(start)), as_dict=True)
+ limit %s, 20""" % (additional_fields, doctype, "%s", "%s"),
+ (customer, cint(start)), as_dict=True)
for doc in transactions:
- doc.items = ", ".join(webnotes.conn.sql_list("""select item_name
- from `tab%s Item` where parent=%s limit 5""" % (doctype, "%s"), doc.name))
+ items = webnotes.conn.sql_list("""select item_name
+ from `tab%s Item` where parent=%s limit 6""" % (doctype, "%s"), doc.name)
+ doc.items = ", ".join(items[:5]) + ("..." if (len(items) > 5) else "")
doc.creation = formatdate(doc.creation)
return transactions
else: