fix: Patch fix, Travis fix and cleanup

- Added UOM column in Report
- Removed mandatory on `valid_till`
- Added list view indicator for Expired status in Supplier Quotation
- Sorted Labels in Chart and syntax cleanup
- Made labels Translatable
- Fixed patch
This commit is contained in:
marination 2020-04-15 12:18:10 +05:30
parent 1bab1539b1
commit 8890b6044d
5 changed files with 31 additions and 21 deletions

View File

@ -796,15 +796,14 @@
{
"fieldname": "valid_till",
"fieldtype": "Date",
"label": "Valid Till",
"reqd": 1
"label": "Valid Till"
}
],
"icon": "fa fa-shopping-cart",
"idx": 29,
"is_submittable": 1,
"links": [],
"modified": "2020-04-14 22:43:32.248415",
"modified": "2020-04-15 11:44:52.958022",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",

View File

@ -5,6 +5,8 @@ frappe.listview_settings['Supplier Quotation'] = {
return [__("Ordered"), "green", "status,=,Ordered"];
} else if(doc.status==="Rejected") {
return [__("Lost"), "darkgrey", "status,=,Lost"];
} else if(doc.status==="Expired") {
return [__("Expired"), "darkgrey", "status,=,Expired"];
}
}
};

View File

@ -61,6 +61,7 @@ frappe.query_reports["Quoted Item Comparison"] = {
prepare_chart_data: (result) => {
let supplier_wise_map = {}, data_points_map = {};
let qty_list = result.map(res => res.qty);
qty_list.sort();
qty_list = new Set(qty_list);
// create supplier wise map like in Report
@ -76,7 +77,7 @@ frappe.query_reports["Quoted Item Comparison"] = {
let row = supplier_wise_map[supplier];
for (let qty of qty_list) {
if (!data_points_map[qty]) {
data_points_map[qty] = []
data_points_map[qty] = [];
}
if (row[qty]) {
data_points_map[qty].push(row[qty]);
@ -90,11 +91,10 @@ frappe.query_reports["Quoted Item Comparison"] = {
let dataset = [];
qty_list.forEach((qty) => {
let datapoints = {
'name': 'Price for Qty ' + qty,
'name': __('Price for Qty ') + qty,
'values': data_points_map[qty]
}
dataset.push(datapoints);
});
return dataset;
},

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cint
from frappe import _
from collections import defaultdict
from erpnext.setup.utils import get_exchange_rate
@ -50,6 +51,7 @@ def get_data(filters, conditions):
"quotation": data.get("parent"),
"qty": data.get("qty"),
"price": flt(data.get("rate") * exchange_rate, float_precision),
"uom": data.get("uom"),
"request_for_quotation": data.get("request_for_quotation"),
"supplier": data.get("supplier") # used for chart generation
}
@ -78,34 +80,41 @@ def get_conditions(filters):
def get_columns():
columns = [{
"fieldname": "supplier_name",
"label": "Supplier",
"label": _("Supplier"),
"fieldtype": "Link",
"options": "Supplier",
"width": 200
},
{
"fieldname": "quotation",
"label": "Supplier Quotation",
"label": _("Supplier Quotation"),
"fieldtype": "Link",
"options": "Supplier Quotation",
"width": 200
},
{
"fieldname": "qty",
"label": "Quantity",
"label": _("Quantity"),
"fieldtype": "Float",
"width": 80
},
{
"fieldname": "price",
"label": "Price",
"label": _("Price"),
"fieldtype": "Currency",
"options": "Company:company:default_currency",
"width": 110
},
{
"fieldname": "uom",
"label": _("UOM"),
"fieldtype": "Link",
"options": "UOM",
"width": 90
},
{
"fieldname": "request_for_quotation",
"label": "Request for Quotation",
"label": _("Request for Quotation"),
"fieldtype": "Link",
"options": "Request for Quotation",
"width": 200

View File

@ -2,7 +2,7 @@ from __future__ import unicode_literals
import frappe
def execute():
reload_doc("buying", "doctype", "suppplier_quotation")
frappe.reload_doc("buying", "doctype", "suppplier_quotation")
frappe.db.sql("""UPDATE `tabSupplier Quotation`
SET valid_till = DATE_ADD(transaction_date , INTERVAL 1 MONTH)
WHERE docstatus < 2""")