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:
parent
1bab1539b1
commit
8890b6044d
@ -796,15 +796,14 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "valid_till",
|
"fieldname": "valid_till",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Valid Till",
|
"label": "Valid Till"
|
||||||
"reqd": 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-shopping-cart",
|
"icon": "fa fa-shopping-cart",
|
||||||
"idx": 29,
|
"idx": 29,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-14 22:43:32.248415",
|
"modified": "2020-04-15 11:44:52.958022",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Supplier Quotation",
|
"name": "Supplier Quotation",
|
||||||
|
@ -5,6 +5,8 @@ frappe.listview_settings['Supplier Quotation'] = {
|
|||||||
return [__("Ordered"), "green", "status,=,Ordered"];
|
return [__("Ordered"), "green", "status,=,Ordered"];
|
||||||
} else if(doc.status==="Rejected") {
|
} else if(doc.status==="Rejected") {
|
||||||
return [__("Lost"), "darkgrey", "status,=,Lost"];
|
return [__("Lost"), "darkgrey", "status,=,Lost"];
|
||||||
|
} else if(doc.status==="Expired") {
|
||||||
|
return [__("Expired"), "darkgrey", "status,=,Expired"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -60,28 +60,29 @@ frappe.query_reports["Quoted Item Comparison"] = {
|
|||||||
|
|
||||||
prepare_chart_data: (result) => {
|
prepare_chart_data: (result) => {
|
||||||
let supplier_wise_map = {}, data_points_map = {};
|
let supplier_wise_map = {}, data_points_map = {};
|
||||||
let qty_list = result.map(res=> res.qty);
|
let qty_list = result.map(res => res.qty);
|
||||||
|
qty_list.sort();
|
||||||
qty_list = new Set(qty_list);
|
qty_list = new Set(qty_list);
|
||||||
|
|
||||||
// create supplier wise map like in Report
|
// create supplier wise map like in Report
|
||||||
for(let res of result){
|
for (let res of result) {
|
||||||
if(!(res.supplier in supplier_wise_map)){
|
if (!(res.supplier in supplier_wise_map)) {
|
||||||
supplier_wise_map[res.supplier]= {};
|
supplier_wise_map[res.supplier] = {};
|
||||||
}
|
}
|
||||||
supplier_wise_map[res.supplier][res.qty] = res.price;
|
supplier_wise_map[res.supplier][res.qty] = res.price;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create datapoints for each qty
|
// create datapoints for each qty
|
||||||
for(let supplier of Object.keys(supplier_wise_map)) {
|
for (let supplier of Object.keys(supplier_wise_map)) {
|
||||||
let row = supplier_wise_map[supplier];
|
let row = supplier_wise_map[supplier];
|
||||||
for(let qty of qty_list){
|
for (let qty of qty_list) {
|
||||||
if(!data_points_map[qty]){
|
if (!data_points_map[qty]) {
|
||||||
data_points_map[qty] = []
|
data_points_map[qty] = [];
|
||||||
}
|
}
|
||||||
if(row[qty]){
|
if (row[qty]) {
|
||||||
data_points_map[qty].push(row[qty]);
|
data_points_map[qty].push(row[qty]);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
data_points_map[qty].push(null);
|
data_points_map[qty].push(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,11 +91,10 @@ frappe.query_reports["Quoted Item Comparison"] = {
|
|||||||
let dataset = [];
|
let dataset = [];
|
||||||
qty_list.forEach((qty) => {
|
qty_list.forEach((qty) => {
|
||||||
let datapoints = {
|
let datapoints = {
|
||||||
'name': 'Price for Qty ' + qty,
|
'name': __('Price for Qty ') + qty,
|
||||||
'values': data_points_map[qty]
|
'values': data_points_map[qty]
|
||||||
}
|
}
|
||||||
dataset.push(datapoints);
|
dataset.push(datapoints);
|
||||||
|
|
||||||
});
|
});
|
||||||
return dataset;
|
return dataset;
|
||||||
},
|
},
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, cint
|
from frappe.utils import flt, cint
|
||||||
|
from frappe import _
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from erpnext.setup.utils import get_exchange_rate
|
from erpnext.setup.utils import get_exchange_rate
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ def get_data(filters, conditions):
|
|||||||
"quotation": data.get("parent"),
|
"quotation": data.get("parent"),
|
||||||
"qty": data.get("qty"),
|
"qty": data.get("qty"),
|
||||||
"price": flt(data.get("rate") * exchange_rate, float_precision),
|
"price": flt(data.get("rate") * exchange_rate, float_precision),
|
||||||
|
"uom": data.get("uom"),
|
||||||
"request_for_quotation": data.get("request_for_quotation"),
|
"request_for_quotation": data.get("request_for_quotation"),
|
||||||
"supplier": data.get("supplier") # used for chart generation
|
"supplier": data.get("supplier") # used for chart generation
|
||||||
}
|
}
|
||||||
@ -78,34 +80,41 @@ def get_conditions(filters):
|
|||||||
def get_columns():
|
def get_columns():
|
||||||
columns = [{
|
columns = [{
|
||||||
"fieldname": "supplier_name",
|
"fieldname": "supplier_name",
|
||||||
"label": "Supplier",
|
"label": _("Supplier"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Supplier",
|
"options": "Supplier",
|
||||||
"width": 200
|
"width": 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "quotation",
|
"fieldname": "quotation",
|
||||||
"label": "Supplier Quotation",
|
"label": _("Supplier Quotation"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Supplier Quotation",
|
"options": "Supplier Quotation",
|
||||||
"width": 200
|
"width": 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "qty",
|
"fieldname": "qty",
|
||||||
"label": "Quantity",
|
"label": _("Quantity"),
|
||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 80
|
"width": 80
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "price",
|
"fieldname": "price",
|
||||||
"label": "Price",
|
"label": _("Price"),
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"width": 110
|
"width": 110
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "uom",
|
||||||
|
"label": _("UOM"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "UOM",
|
||||||
|
"width": 90
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "request_for_quotation",
|
"fieldname": "request_for_quotation",
|
||||||
"label": "Request for Quotation",
|
"label": _("Request for Quotation"),
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Request for Quotation",
|
"options": "Request for Quotation",
|
||||||
"width": 200
|
"width": 200
|
||||||
|
@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
reload_doc("buying", "doctype", "suppplier_quotation")
|
frappe.reload_doc("buying", "doctype", "suppplier_quotation")
|
||||||
frappe.db.sql("""UPDATE `tabSupplier Quotation`
|
frappe.db.sql("""UPDATE `tabSupplier Quotation`
|
||||||
SET valid_till = DATE_ADD(transaction_date , INTERVAL 1 MONTH)
|
SET valid_till = DATE_ADD(transaction_date , INTERVAL 1 MONTH)
|
||||||
WHERE docstatus < 2""")
|
WHERE docstatus < 2""")
|
Loading…
Reference in New Issue
Block a user