[fix] Shipment in portal. Fixes #4291
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index 046e6f6..45f6af0 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -46,15 +46,14 @@
             </div>
             <div class="col-sm-2 col-xs-3 text-right">
                 {{ d.qty }}
-                {% if d.delivered_qty != None %}
+                {% if d.delivered_qty is defined and d.delivered_qty != None %}
                 <p class="text-muted small">{{
                     _("Delivered: {0}").format(d.delivered_qty) }}</p>
                 {% endif %}
             </div>
             <div class="col-sm-2 col-xs-3 text-right">
                 {{ d.get_formatted("amount") }}
-				<!-- output of get_formatted("rate") is unicode, to replace unicode use 
-					_("text {0}").decode("utf8").format(val) -->
+				{# output of get_formatted("rate") is unicode, to replace unicode use _("text {0}").decode("utf8").format(val) #}
                 <p class="text-muted small">{{
                     _("Rate: {0}").decode("utf8").format(d.get_formatted("rate")) }}</p>
             </div>