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
This commit is contained in:
Rushabh Mehta 2017-08-10 21:06:09 +05:30 committed by GitHub
parent 5ae39ae79a
commit dbb5154f37
11 changed files with 74 additions and 48 deletions

View File

@ -50,7 +50,8 @@ calendars = ["Task", "Production Order", "Leave Application", "Sales Order", "Ho
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 @@ website_route_rules = [
{"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"},

View File

@ -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;

View File

@ -76,12 +76,6 @@
}
.transaction-list-item {
&:hover,
&:active,
&:focus {
background-color: @light-bg;
}
.indicator {
font-weight: inherit;
color: @text-muted;

View File

@ -57,7 +57,7 @@ QUnit.test('Test: Student Group', function(assert){
() => 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');
},

View File

@ -38,10 +38,6 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
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))
}

View File

@ -14,6 +14,14 @@ form_grid_templates = {
}
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()

View File

@ -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") {

View File

@ -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>

View File

@ -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>

View File

@ -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) %}
@ -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 %}

View File

@ -15,7 +15,7 @@ def get_context(context):
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 @@ def get_context(context):
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})