Fixes in Order / Quotation (#10361)
* Additions in Order Page for Sidebar Menu with "Order" page route
* Adjust Columns in order_taxes.html to avoid number breaks for more precisions
* Fields additions in transaction_row.html
* [fix] style for order pages, indicator for quotation etc
* [fix] style for order pages, indicator for quotation etc
* [test] add timeout
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index fc8d39b..4df83af 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -50,7 +50,8 @@
fixtures = ["Web Form"]
-website_generators = ["Item Group", "Item", "BOM", "Sales Partner", "Job Opening", "Student Admission"]
+website_generators = ["Item Group", "Item", "BOM", "Sales Partner",
+ "Job Opening", "Student Admission"]
website_context = {
"favicon": "/assets/erpnext/images/favicon.png",
@@ -83,7 +84,7 @@
{"from_route": "/quotations/<path:name>", "to_route": "order",
"defaults": {
"doctype": "Quotation",
- "parents": [{"label": _("Quotations"), "route": "quotation"}]
+ "parents": [{"label": _("Quotations"), "route": "quotations"}]
}
},
{"from_route": "/shipments", "to_route": "Delivery Note"},
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 0245675..733194a 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -62,11 +62,6 @@
.featured-products {
border-top: 1px solid #EBEFF2;
}
-.transaction-list-item:hover,
-.transaction-list-item:active,
-.transaction-list-item:focus {
- background-color: #fafbfc;
-}
.transaction-list-item .indicator {
font-weight: inherit;
color: #8D99A6;
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index 79a89a0..25172a1 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -76,12 +76,6 @@
}
.transaction-list-item {
- &:hover,
- &:active,
- &:focus {
- background-color: @light-bg;
- }
-
.indicator {
font-weight: inherit;
color: @text-muted;
diff --git a/erpnext/schools/doctype/student_group/test_student_group.js b/erpnext/schools/doctype/student_group/test_student_group.js
index df72ae9..634ad18 100644
--- a/erpnext/schools/doctype/student_group/test_student_group.js
+++ b/erpnext/schools/doctype/student_group/test_student_group.js
@@ -57,7 +57,7 @@
() => frappe.set_route("Form", ('Student Group/' + index)),
() => frappe.timeout(0.5),
() => frappe.tests.click_button('Get Students'),
- () => frappe.timeout(0.5),
+ () => frappe.timeout(1),
() => {
assert.equal(cur_frm.doc.students.length, 5, 'Successfully fetched list of students');
},
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index c149742..3e5e52f 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -38,10 +38,6 @@
var me = this;
- if (doc.valid_till && frappe.datetime.get_diff(doc.valid_till, frappe.datetime.get_today()) < 0) {
- this.frm.set_intro(__("Validity period of this quotation has ended"));
- }
-
if (doc.__islocal) {
this.frm.set_value('valid_till', frappe.datetime.add_months(doc.transaction_date, 1))
}
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 5eb8b06..1e6dbca 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -14,6 +14,14 @@
}
class Quotation(SellingController):
+ def set_indicator(self):
+ if self.docstatus==1:
+ self.indicator_color = 'blue'
+ self.indicator_title = 'Submitted'
+ if self.valid_till and getdate(self.valid_till) < getdate(nowdate()):
+ self.indicator_color = 'darkgrey'
+ self.indicator_title = 'Expired'
+
def validate(self):
super(Quotation, self).validate()
self.set_status()
diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js
index 204ace1..8baf9b2 100644
--- a/erpnext/selling/doctype/quotation/quotation_list.js
+++ b/erpnext/selling/doctype/quotation/quotation_list.js
@@ -1,9 +1,13 @@
frappe.listview_settings['Quotation'] = {
add_fields: ["customer_name", "base_grand_total", "status",
- "company", "currency"],
+ "company", "currency", 'valid_till'],
get_indicator: function(doc) {
if(doc.status==="Submitted") {
- return [__("Submitted"), "blue", "status,=,Submitted"];
+ if (doc.valid_till && doc.valid_till < frappe.datetime.nowdate()) {
+ return [__("Expired"), "darkgrey", "valid_till,<," + frappe.datetime.nowdate()];
+ } else {
+ return [__("Submitted"), "blue", "status,=,Submitted"];
+ }
} else if(doc.status==="Ordered") {
return [__("Ordered"), "green", "status,=,Ordered"];
} else if(doc.status==="Lost") {
diff --git a/erpnext/templates/includes/order/order_taxes.html b/erpnext/templates/includes/order/order_taxes.html
index 471576f..462d77d 100644
--- a/erpnext/templates/includes/order/order_taxes.html
+++ b/erpnext/templates/includes/order/order_taxes.html
@@ -1,22 +1,22 @@
{% if doc.taxes %}
<div class="row tax-net-total-row">
- <div class="col-xs-8 text-right">{{ _("Net Total") }}</div>
- <div class="col-xs-4 text-right">
+ <div class="col-xs-6 text-right">{{ _("Net Total") }}</div>
+ <div class="col-xs-6 text-right">
{{ doc.get_formatted("net_total") }}</div>
</div>
{% endif %}
{% for d in doc.taxes %}
{% if d.base_tax_amount > 0 %}
<div class="row tax-row">
- <div class="col-xs-8 text-right">{{ d.description }}</div>
- <div class="col-xs-4 text-right">
+ <div class="col-xs-6 text-right">{{ d.description }}</div>
+ <div class="col-xs-6 text-right">
{{ d.get_formatted("base_tax_amount") }}</div>
</div>
{% endif %}
{% endfor %}
<div class="row tax-grand-total-row">
- <div class="col-xs-8 text-right text-uppercase h6 text-muted">{{ _("Grand Total") }}</div>
- <div class="col-xs-4 text-right">
+ <div class="col-xs-6 text-right text-uppercase h6 text-muted">{{ _("Grand Total") }}</div>
+ <div class="col-xs-6 text-right">
<span class="tax-grand-total bold">
{{ doc.get_formatted("grand_total") }}
</span>
diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html
index 10d7605..0e47f7d 100644
--- a/erpnext/templates/includes/transaction_row.html
+++ b/erpnext/templates/includes/transaction_row.html
@@ -1,23 +1,22 @@
<div class="web-list-item transaction-list-item">
<a href="/{{ pathname }}/{{ doc.name }}">
<div class="row">
- <div class="col-sm-5">
- <span class="indicator small {{ doc.indicator_color or "darkgrey" }}">
+ <div class="col-sm-4" style='margin-top: -3px;'>
+ <span class="indicator small {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{{ doc.name }}</span>
<div class="small text-muted transaction-time"
title="{{ frappe.utils.format_datetime(doc.modified, "medium") }}">
- {{ frappe.utils.format_datetime(doc.modified, "medium") }}
+ {{ frappe.utils.global_date_format(doc.modified) }}
</div>
</div>
- <div class="col-sm-4 items-preview ellipsis small">
- {{ doc.items_preview }}
+ <div class="col-sm-5">
+ <div class="small text-muted items-preview ellipsis">
+ {{ doc.items_preview }}
+ </div>
</div>
<div class="col-sm-3 text-right bold">
{{ doc.get_formatted("grand_total") }}
</div>
- <!-- <div class="col-sm-3 text-right">
-
- </div> -->
</div>
</a>
</div>
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index 2481808..8a495b1 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -7,21 +7,44 @@
{% block title %}{{ doc.name }}{% endblock %}
-{% block header %}<h1>{{ doc.name }}</h1>{% endblock %}
+{% block header %}
+ <h1>{{ doc.name }}</h1>
+{% endblock %}
+
+{% block header_actions %}
+<a class='btn btn-xs btn-default' href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}' target="_blank" rel="noopener noreferrer">{{ _("Print") }}</a>
+{% endblock %}
{% block page_content %}
<div class="row transaction-subheading">
<div class="col-xs-6">
- <span class="indicator {{ doc.indicator_color or "darkgrey" }}">
+ <span class="indicator {{ doc.indicator_color or ("blue" if doc.docstatus==1 else "darkgrey") }}">
{{ doc.indicator_title or doc.status or "Submitted" }}
</span>
</div>
<div class="col-xs-6 text-muted text-right small">
{{ frappe.utils.formatdate(doc.transaction_date, 'medium') }}
+ {% if doc.valid_till %}
+ <p>
+ {{ _("Valid Till") }}: {{ frappe.utils.formatdate(doc.valid_till, 'medium') }}
+ </p>
+ {% endif %}
</div>
</div>
+<p class='small' style='padding-top: 15px;'>
+{% if doc.doctype == 'Supplier Quotation' %}
+ <b>{{ doc.supplier_name}}</b>
+{% else %}
+ <b>{{ doc.customer_name}}</b>
+{% endif %}
+{% if doc.contact_display %}
+ <br>
+ {{ doc.contact_display }}
+{% endif %}
+</p>
+
{% if doc._header %}
{{ doc._header }}
{% endif %}
@@ -31,29 +54,29 @@
<!-- items -->
<div class="order-item-table">
<div class="row order-items order-item-header text-muted">
- <div class="col-sm-8 col-xs-6 h6 text-uppercase">
+ <div class="col-sm-6 col-xs-6 h6 text-uppercase">
{{ _("Item") }}
</div>
- <div class="col-sm-2 col-xs-3 text-right h6 text-uppercase">
+ <div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
{{ _("Quantity") }}
</div>
- <div class="col-sm-2 col-xs-3 text-right h6 text-uppercase">
+ <div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
{{ _("Amount") }}
</div>
</div>
{% for d in doc.items %}
<div class="row order-items">
- <div class="col-sm-8 col-xs-6">
+ <div class="col-sm-6 col-xs-6">
{{ item_name_and_description(d) }}
</div>
- <div class="col-sm-2 col-xs-3 text-right">
+ <div class="col-sm-3 col-xs-3 text-right">
{{ d.qty }}
{% 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">
+ <div class="col-sm-3 col-xs-3 text-right">
{{ d.get_formatted("amount") }}
<p class="text-muted small">{{
_("@ {0}").format(d.get_formatted("rate")) }}</p>
@@ -72,8 +95,8 @@
</div>
<div class="cart-taxes row small">
- <div class="col-sm-8"><!-- empty --></div>
- <div class="col-sm-4">
+ <div class="col-sm-6"><!-- empty --></div>
+ <div class="col-sm-6">
{% if enabled_checkout %}
{% if (doc.doctype=="Sales Order" and doc.per_billed <= 0)
or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %}
@@ -86,7 +109,7 @@
{% endif %}
{% endif %}
</div>
-
+
{% if attachments %}
<div class="order-item-table">
<div class="row order-items order-item-header text-muted">
@@ -106,4 +129,9 @@
</div>
{% endif %}
</div>
+{% if doc.terms %}
+<div class="terms-and-condition text-muted small">
+ <hr><p>{{ doc.terms }}</p>
+</div>
+{% endif %}
{% endblock %}
diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py
index 7551a0f..110eb57 100644
--- a/erpnext/templates/pages/order.py
+++ b/erpnext/templates/pages/order.py
@@ -15,7 +15,7 @@
context.doc.set_indicator()
if show_attachments():
- context.attachments = get_attachments(frappe.form_dict.doctype, frappe.form_dict.name)
+ context.attachments = get_attachments(frappe.form_dict.doctype, frappe.form_dict.name)
context.parents = frappe.form_dict.parents
context.title = frappe.form_dict.name
@@ -28,5 +28,6 @@
frappe.throw(_("Not Permitted"), frappe.PermissionError)
def get_attachments(dt, dn):
- return frappe.get_all("File", fields=["name", "file_name", "file_url", "is_private"],
- filters = {"attached_to_name": dn, "attached_to_doctype": dt, "is_private":0})
+ return frappe.get_all("File",
+ fields=["name", "file_name", "file_url", "is_private"],
+ filters = {"attached_to_name": dn, "attached_to_doctype": dt, "is_private":0})