Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter, code cleanup #12852

Merged
merged 1 commit into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
setup: function(doc) {
this.setup_posting_date_time_check();
this._super(doc);

// formatter for material request item
this.frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
},
onload: function() {
this._super();
Expand All @@ -20,10 +24,6 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
} else {
this.frm.set_value("disable_rounded_total", cint(frappe.sys_defaults.disable_rounded_total));
}

// formatter for material request item
this.frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
},

refresh: function(doc) {
Expand Down
6 changes: 3 additions & 3 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ frappe.ui.form.on("Purchase Order", {
'Purchase Invoice': 'Invoice',
'Stock Entry': 'Material to Supplier'
}

frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
},

onload: function(frm) {
Expand All @@ -25,9 +28,6 @@ frappe.ui.form.on("Purchase Order", {
frm.toggle_display('get_last_purchase_rate',
frm.doc.__onload.disable_fetch_last_purchase_rate);
}

frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
/* global frappe, refresh_field */

frappe.ui.form.on("Supplier Scorecard", {

onload: function(frm) {

setup: function(frm) {
if (frm.doc.indicator_color !== "") {
frm.set_indicator_formatter("status", function(doc) {
return doc.indicator_color.toLowerCase();
});
}
},
onload: function(frm) {
if (frm.doc.__unsaved == 1) {
loadAllCriteria(frm);
loadAllStandings(frm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ frappe.ui.form.on("Production Order", {
]
}
});

// formatter for production order operation
frm.set_indicator_formatter('operation',
function(doc) { return (frm.doc.qty==doc.completed_qty) ? "green" : "orange" });
},

onload: function(frm) {
Expand All @@ -94,10 +98,6 @@ frappe.ui.form.on("Production Order", {
});
erpnext.production_order.set_default_warehouse(frm);
}

// formatter for production order operation
frm.set_indicator_formatter('operation',
function(doc) { return (frm.doc.qty==doc.completed_qty) ? "green" : "orange" });
},

refresh: function(frm) {
Expand Down
8 changes: 4 additions & 4 deletions erpnext/selling/doctype/sales_order/sales_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ frappe.ui.form.on("Sales Order", {
'Project': 'Project'
}
frm.add_fetch('customer', 'tax_id', 'tax_id');

// formatter for material request item
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.stock_qty<=doc.delivered_qty) ? "green" : "orange" })
},
onload: function(frm) {
erpnext.queries.setup_queries(frm, "Warehouse", function() {
Expand All @@ -28,10 +32,6 @@ frappe.ui.form.on("Sales Order", {
}
});

// formatter for material request item
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.stock_qty<=doc.delivered_qty) ? "green" : "orange" })

erpnext.queries.setup_warehouse_query(frm);
},

Expand Down
9 changes: 4 additions & 5 deletions erpnext/stock/doctype/material_request/material_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ frappe.ui.form.on('Material Request', {
'Supplier Quotation': 'Supplier Quotation',
'Production Order': 'Production Order'
}

// formatter for material request item
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" })
},
onload: function(frm) {
// add item, if previous view was item
erpnext.utils.add_item(frm);

//set schedule_date
set_schedule_date(frm);

// formatter for material request item
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" }),

frm.fields_dict["items"].grid.get_field("warehouse").get_query = function(doc, cdt, cdn){
return{
filters: {'company': doc.company}
Expand Down