',
- __("Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria."),
- '
',
- '
',
- __("If selected Pricing Rule is made for 'Price', it will overwrite Price List. Pricing Rule price is the final price, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field."),
- '
',
- '
',
- __('Discount Percentage can be applied either against a Price List or for all Price List.'),
- '
',
- '
',
- __('To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled.'),
- '
',
- '
',
- '
',
- '
',
- '
',
- __('How Pricing Rule is applied?'),
- '
',
- '',
- '
',
- __("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand."),
- '
',
- '
',
- __("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc."),
- '
',
- '
',
- __('Pricing Rules are further filtered based on quantity.'),
- '
',
- '
',
- __('If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions.'),
- '
',
- '
',
- __('Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:'),
- '
',
- '
',
- __('Item Code > Item Group > Brand'),
- '
',
- '
',
- __('Customer > Customer Group > Territory'),
- '
',
- '
',
- __('Supplier > Supplier Type'),
- '
',
- '
',
- '
',
- '
',
- __('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.'),
- '
',
- '',
- '
',
- '
'].join("\n");
+ var help_content =
+ `
+
+
+
+ ${__('Notes')}
+
+
+
+ ${__("Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria.")}
+
+
+ ${__("If selected Pricing Rule is made for 'Price', it will overwrite Price List. Pricing Rule price is the final price, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field.")}
+
+
+ ${__('Discount Percentage can be applied either against a Price List or for all Price List.')}
+
+
+ ${__('To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled.')}
+
+
+
+
+
+ ${__('How Pricing Rule is applied?')}
+
+
+
+ ${__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand.")}
+
+
+ ${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc.")}
+
+
+ ${__('Pricing Rules are further filtered based on quantity.')}
+
+
+ ${__('If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions.')}
+
+
+ ${__('Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:')}
+
+
+ ${__('Item Code > Item Group > Brand')}
+
+
+ ${__('Customer > Customer Group > Territory')}
+
+
+ ${__('Supplier > Supplier Type')}
+
+
+
+
+ ${__('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.')}
+
+
+
+
`;
set_field_options("pricing_rule_help", help_content);
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index b48fb20d6f6..94621513f3d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -101,8 +101,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
account: this.frm.doc.credit_to,
price_list: this.frm.doc.buying_price_list,
}, function() {
- me.apply_pricing_rule();
- })
+ me.apply_pricing_rule();
+ })
},
credit_to: function() {
@@ -130,7 +130,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(cint(this.frm.doc.is_paid)) {
if(!this.frm.doc.company) {
this.frm.set_value("is_paid", 0)
- msgprint(__("Please specify Company to proceed"));
+ frappe.msgprint(__("Please specify Company to proceed"));
}
}
this.calculate_outstanding_amount();
@@ -195,19 +195,19 @@ cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
// Hide Fields
// ------------
function hide_fields(doc) {
- parent_fields = ['due_date', 'is_opening', 'advances_section', 'from_date', 'to_date'];
+ var parent_fields = ['due_date', 'is_opening', 'advances_section', 'from_date', 'to_date'];
if(cint(doc.is_paid) == 1) {
hide_field(parent_fields);
} else {
- for (i in parent_fields) {
+ for (var i in parent_fields) {
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
if(!docfield.hidden) unhide_field(parent_fields[i]);
}
}
- item_fields_stock = ['warehouse_section', 'received_qty', 'rejected_qty'];
+ var item_fields_stock = ['warehouse_section', 'received_qty', 'rejected_qty'];
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
index a1d8bf85d27..eb0ea7fef81 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js
@@ -9,11 +9,11 @@ frappe.ui.form.on("Purchase Taxes and Charges", "add_deduct_tax", function(doc,
var d = locals[cdt][cdn];
if(!d.category && d.add_deduct_tax) {
- msgprint(__("Please select Category first"));
+ frappe.msgprint(__("Please select Category first"));
d.add_deduct_tax = '';
}
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
- msgprint(__("Cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
+ frappe.msgprint(__("Cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
d.add_deduct_tax = '';
}
refresh_field('add_deduct_tax', d.name, 'taxes');
@@ -23,7 +23,7 @@ frappe.ui.form.on("Purchase Taxes and Charges", "category", function(doc, cdt, c
var d = locals[cdt][cdn];
if (d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
- msgprint(__("Cannot deduct when category is for 'Valuation' or 'Vaulation and Total'"));
+ frappe.msgprint(__("Cannot deduct when category is for 'Valuation' or 'Vaulation and Total'"));
d.add_deduct_tax = '';
}
refresh_field('add_deduct_tax', d.name, 'taxes');
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 3fbde29bbff..e03d4d4efe2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -175,8 +175,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
account: this.frm.doc.debit_to,
price_list: this.frm.doc.selling_price_list,
}, function() {
- me.apply_pricing_rule();
- })
+ me.apply_pricing_rule();
+ })
},
debit_to: function() {
@@ -267,7 +267,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(this.frm.doc.is_pos) {
if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0);
- msgprint(__("Please specify Company to proceed"));
+ frappe.msgprint(__("Please specify Company to proceed"));
} else {
var me = this;
return this.frm.call({
@@ -311,19 +311,19 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
// Hide Fields
// ------------
cur_frm.cscript.hide_fields = function(doc) {
- parent_fields = ['project', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances',
+ var parent_fields = ['project', 'due_date', 'is_opening', 'source', 'total_advance', 'get_advances',
'advances', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date'];
if(cint(doc.is_pos) == 1) {
hide_field(parent_fields);
} else {
- for (i in parent_fields) {
+ for (var i in parent_fields) {
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
if(!docfield.hidden) unhide_field(parent_fields[i]);
}
}
- item_fields_stock = ['batch_no', 'actual_batch_qty', 'actual_qty', 'expense_account',
+ var item_fields_stock = ['batch_no', 'actual_batch_qty', 'actual_qty', 'expense_account',
'warehouse', 'expense_account', 'quality_inspection']
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));
@@ -400,7 +400,7 @@ cur_frm.set_query("income_account", "items", function(doc) {
});
// expense account
-if (sys_defaults.auto_accounting_for_stock) {
+if (frappe.sys_defaults.auto_accounting_for_stock) {
cur_frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
return {
filters: {
@@ -442,11 +442,12 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
})
if(cur_frm.doc.is_pos) {
- cur_frm.msgbox = frappe.msgprint(format('{0}\
- {1}', [
- __('Print'), __('New')
- ]));
+ cur_frm.msgbox = frappe.msgprint(
+ `
+ ${__('Print')}
+
+ ${__('New')}`
+ );
} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index dc524e109d3..b80bf464cad 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -113,7 +113,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
email_prompt: function() {
var me = this;
- fields = [{label:__("To"), fieldtype:"Data", reqd: 0, fieldname:"recipients",length:524288},
+ var fields = [{label:__("To"), fieldtype:"Data", reqd: 0, fieldname:"recipients",length:524288},
{fieldtype: "Section Break", collapsible: 1, label: "CC & Standard Reply"},
{fieldtype: "Section Break"},
{label:__("Subject"), fieldtype:"Data", reqd: 1,
@@ -602,7 +602,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
var html = "";
if(this.si_docs.length) {
this.si_docs.forEach(function (data, i) {
- for (key in data) {
+ for (var key in data) {
html += frappe.render_template("pos_invoice_list", {
sr: i + 1,
name: key,
@@ -965,7 +965,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
make_item_list: function () {
var me = this;
if (!this.price_list) {
- msgprint(__("Price List not found or disabled"));
+ frappe.msgprint(__("Price List not found or disabled"));
return;
}
@@ -1232,7 +1232,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
remove_zero_qty_item: function () {
var me = this;
- idx = 0
+ var idx = 0;
this.items = []
$.each(this.frm.doc["items"] || [], function (i, d) {
if (!in_list(me.remove_item, d.idx)) {
@@ -1250,7 +1250,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.wrapper.find('input.discount-percentage').on("change", function () {
me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage"));
- total = me.frm.doc.grand_total
+ var total = me.frm.doc.grand_total
if (me.frm.doc.apply_discount_on == 'Net Total') {
total = me.frm.doc.net_total
@@ -1442,7 +1442,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
if (this.frm.doc.docstatus == 1) {
this.page.set_secondary_action(__("Print"), function () {
- html = frappe.render(me.print_template_data, me.frm.doc)
+ var html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
this.page.add_menu_item(__("Email"), function () {
@@ -1465,19 +1465,18 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
print_dialog: function () {
var me = this;
- this.msgprint = frappe.msgprint(format('{0}\
- {1}', [
- __('Print'), __('New')
- ]));
+ this.frappe.msgprint = frappe.msgprint(
+ `${__('Print')}
+ ${__('New')}`);
$('.print_doc').click(function () {
- html = frappe.render(me.print_template_data, me.frm.doc)
+ var html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
$('.new_doc').click(function () {
- me.msgprint.hide()
+ me.frappe.msgprint.hide()
me.make_new_cart()
})
},
@@ -1506,9 +1505,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
//Remove the sold serial no from the cache
$.each(this.frm.doc.items, function(index, data) {
- sn = data.serial_no.split('\n')
+ var sn = data.serial_no.split('\n')
if(sn.length) {
- serial_no_list = me.serial_no_data[data.item_code]
+ var serial_no_list = me.serial_no_data[data.item_code]
if(serial_no_list) {
$.each(sn, function(i, serial_no) {
if(in_list(Object.keys(serial_no_list), serial_no)) {
@@ -1531,7 +1530,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
toggle_input_field: function () {
var pointer_events = 'inherit'
- disabled = this.frm.doc.docstatus == 1 ? true: false;
+ var disabled = this.frm.doc.docstatus == 1 ? true: false;
$(this.wrapper).find('input').attr("disabled", disabled);
$(this.wrapper).find('select').attr("disabled", disabled);
$(this.wrapper).find('input').attr("disabled", disabled);
@@ -1571,7 +1570,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
var me = this;
this.si_docs = this.get_doc_from_localstorage();
$.each(this.si_docs, function (index, data) {
- for (key in data) {
+ for (var key in data) {
if (key == me.name) {
me.si_docs[index][key] = me.frm.doc;
me.update_localstorage();
@@ -1634,10 +1633,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
get_submitted_invoice: function () {
var invoices = [];
var index = 1;
- docs = this.get_doc_from_localstorage();
+ var docs = this.get_doc_from_localstorage();
if (docs) {
invoices = $.map(docs, function (data) {
- for (key in data) {
+ for (var key in data) {
if (data[key].docstatus == 1 && index < 50) {
index++
data[key].docstatus = 0;
@@ -1656,7 +1655,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.new_si_docs = [];
if (this.removed_items) {
$.each(this.si_docs, function (index, data) {
- for (key in data) {
+ for (var key in data) {
if (!in_list(me.removed_items, key)) {
me.new_si_docs.push(data);
}
@@ -1715,8 +1714,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
validate_serial_no: function () {
var me = this;
- var item_code = serial_no = '';
- for (key in this.item_serial_no) {
+ var item_code = ''
+ var serial_no = '';
+ for (var key in this.item_serial_no) {
item_code = key;
serial_no = me.item_serial_no[key][0];
}
@@ -1763,20 +1763,24 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
mandatory_batch_no: function () {
var me = this;
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
- frappe.prompt([
- {'fieldname': 'batch', 'fieldtype': 'Select', 'label': __('Batch No'), 'reqd': 1, 'options':this.batch_no_data[this.items[0].item_code]}
- ],
- function(values){
- me.item_batch_no[me.items[0].item_code] = values.batch;
- },
- __('Select Batch No'))
- }
+ frappe.prompt([{
+ 'fieldname': 'batch',
+ 'fieldtype': 'Select',
+ 'label': __('Batch No'),
+ 'reqd': 1,
+ 'options': this.batch_no_data[this.items[0].item_code]
+ }],
+ function(values){
+ me.item_batch_no[me.items[0].item_code] = values.batch;
+ },
+ __('Select Batch No'))
+ }
},
apply_pricing_rule: function () {
var me = this;
$.each(this.frm.doc["items"], function (n, item) {
- pricing_rule = me.get_pricing_rule(item)
+ var pricing_rule = me.get_pricing_rule(item)
me.validate_pricing_rule(pricing_rule)
if (pricing_rule.length) {
item.pricing_rule = pricing_rule[0].name;
@@ -1836,7 +1840,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
validate_condition: function (data) {
//This method check condition based on applicable for
- condition = this.get_mapper_for_pricing_rule(data)[data.applicable_for]
+ var condition = this.get_mapper_for_pricing_rule(data)[data.applicable_for]
if (in_list(condition[1], condition[0])) {
return true
}
@@ -1869,7 +1873,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}
})
- count = 0
+ var count = 0
$.each(priority_list, function (index, value) {
if (value == priority) {
count++
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 3ab522e4982..0c24feb96d5 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable"] = {
"fieldname":"report_date",
"label": __("As on Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"ageing_based_on",
"label": __("Ageing Based On"),
"fieldtype": "Select",
- "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "options": 'Posting Date\nDue Date',
"default": "Posting Date"
},
{
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
index 0a1734ae22c..6277cc764da 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
@@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable Summary"] = {
"fieldname":"report_date",
"label": __("Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"ageing_based_on",
"label": __("Ageing Based On"),
"fieldtype": "Select",
- "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "options": 'Posting Date\nDue Date',
"default": "Posting Date"
},
{
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index f98d0378ed2..55d863928f5 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"),
"fieldtype": "Select",
- "options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
+ "options": "\nFixed Days\nLast Day of the Next Month"
},
{
"fieldtype": "Break",
@@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"report_date",
"label": __("As on Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"ageing_based_on",
"label": __("Ageing Based On"),
"fieldtype": "Select",
- "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "options": 'Posting Date\nDue Date',
"default": "Posting Date"
},
{
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
index a18c1a7e79a..ceed5e595ba 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
@@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"),
"fieldtype": "Select",
- "options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month"
+ "options": "\nFixed Days\nLast Day of the Next Month"
},
{
"fieldtype": "Break",
@@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldname":"report_date",
"label": __("Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"ageing_based_on",
"label": __("Ageing Based On"),
"fieldtype": "Select",
- "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "options": 'Posting Date\nDue Date',
"default": "Posting Date"
},
{
@@ -70,7 +70,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
onload: function(report) {
report.page.add_inner_button(__("Accounts Receivable"), function() {
var filters = report.get_values();
- frappe.set_route('query-report', 'Accounts Receivable', {company: filters.company});
+ frappe.set_route('query-report', 'Accounts Receivable', { company: filters.company });
});
}
}
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
index e4f0384dcd2..dbee0229737 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
@@ -14,7 +14,7 @@ frappe.query_reports["Bank Clearance Summary"] = {
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"account",
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
index e420fb9dd10..0f9fdd7c023 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -25,7 +25,7 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
"fieldname":"report_date",
"label": __("Date"),
"fieldtype": "Date",
- "default": get_today(),
+ "default": frappe.datetime.get_today(),
"reqd": 1
},
]
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
index 2b7f1f3809f..1315b25d75c 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
@@ -8,7 +8,7 @@ frappe.query_reports["Budget Variance Report"] = {
label: __("Fiscal Year"),
fieldtype: "Link",
options: "Fiscal Year",
- default: sys_defaults.fiscal_year,
+ default: frappe.sys_defaults.fiscal_year,
reqd: 1
},
{
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
index bad826ed148..8d33524abb2 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Purchase Register"] = {
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname": "item_code",
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
index 142a55f3c5b..65cec518fe8 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"customer",
diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
index 5c20510fc4c..9d4a3527a96 100644
--- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
+++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
@@ -21,7 +21,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
fieldname:"to_date",
label: __("To Date"),
fieldtype: "Date",
- default: get_today()
+ default: frappe.datetime.get_today()
},
{
fieldname:"payment_type",
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
index cc00b2af301..a95cfacaeef 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
@@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
frappe.query_reports["Purchase Invoice Trends"] = {
- filters: get_filters()
+ filters: erpnext.get_purchase_trends_filters()
}
});
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index d32f7b64c08..cd795310da7 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -14,7 +14,7 @@ frappe.query_reports["Purchase Register"] = {
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"supplier",
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
index 0f92223d386..2d320f52cfa 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
@@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.query_reports["Sales Invoice Trends"] = {
- filters: get_filters()
+ filters: erpnext.get_sales_trends_filters()
}
});
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js
index d7aac5a83d7..2ac4ae8b2ab 100644
--- a/erpnext/accounts/report/sales_register/sales_register.js
+++ b/erpnext/accounts/report/sales_register/sales_register.js
@@ -14,7 +14,7 @@ frappe.query_reports["Sales Register"] = {
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
- "default": get_today()
+ "default": frappe.datetime.get_today()
},
{
"fieldname":"customer",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index cfd333670a3..c533e6bbcdd 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -55,7 +55,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
if(is_drop_ship && doc.status!="Delivered"){
cur_frm.add_custom_button(__('Delivered'),
- this.delivered_by_supplier, __("Status"));
+ this.delivered_by_supplier, __("Status"));
cur_frm.page.set_inner_btn_group_as_primary(__("Status"));
}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
index f6e7eeba270..99f372b8ff5 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js
@@ -1,34 +1,34 @@
frappe.listview_settings['Purchase Order'] = {
add_fields: ["base_grand_total", "company", "currency", "supplier",
"supplier_name", "per_received", "per_billed", "status"],
- get_indicator: function(doc) {
- if(doc.status==="Closed"){
+ get_indicator: function (doc) {
+ if (doc.status === "Closed") {
return [__("Closed"), "green", "status,=,Closed"];
- } else if (doc.status==="Delivered") {
+ } else if (doc.status === "Delivered") {
return [__("Delivered"), "green", "status,=,Closed"];
- }else if(flt(doc.per_received, 2) < 100 && doc.status!=="Closed") {
- if(flt(doc.per_billed, 2) < 100) {
+ } else if (flt(doc.per_received, 2) < 100 && doc.status !== "Closed") {
+ if (flt(doc.per_billed, 2) < 100) {
return [__("To Receive and Bill"), "orange",
"per_received,<,100|per_billed,<,100|status,!=,Closed"];
} else {
return [__("To Receive"), "orange",
"per_received,<,100|per_billed,=,100|status,!=,Closed"];
}
- } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status!=="Closed") {
+ } else if (flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) < 100 && doc.status !== "Closed") {
return [__("To Bill"), "orange", "per_received,=,100|per_billed,<,100|status,!=,Closed"];
- } else if(flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status!=="Closed") {
+ } else if (flt(doc.per_received, 2) == 100 && flt(doc.per_billed, 2) == 100 && doc.status !== "Closed") {
return [__("Completed"), "green", "per_received,=,100|per_billed,=,100|status,!=,Closed"];
}
},
- onload: function(listview) {
+ onload: function (listview) {
var method = "erpnext.buying.doctype.purchase_order.purchase_order.close_or_unclose_purchase_orders";
- listview.page.add_menu_item(__("Close"), function() {
- listview.call_for_selected_items(method, {"status": "Closed"});
+ listview.page.add_menu_item(__("Close"), function () {
+ listview.call_for_selected_items(method, { "status": "Closed" });
});
- listview.page.add_menu_item(__("Re-open"), function() {
- listview.call_for_selected_items(method, {"status": "Submitted"});
+ listview.page.add_menu_item(__("Re-open"), function () {
+ listview.call_for_selected_items(method, { "status": "Submitted" });
});
}
};
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index 593f6679944..ce759aaae86 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -56,17 +56,17 @@ frappe.ui.form.on("Request for Quotation",{
var dialog = new frappe.ui.Dialog({
title: __("For Supplier"),
fields: [
- {"fieldtype": "Select", "label": __("Supplier"),
- "fieldname": "supplier", "options":"Supplier",
- "options": $.map(doc.suppliers,
- function(d) { return d.supplier }), "reqd": 1 },
- {"fieldtype": "Button", "label": __("Make Supplier Quotation"),
- "fieldname": "make_supplier_quotation", "cssClass": "btn-primary"},
+ { "fieldtype": "Select", "label": __("Supplier"),
+ "fieldname": "supplier",
+ "options": doc.suppliers.map(d => d.supplier),
+ "reqd": 1 },
+ { "fieldtype": "Button", "label": __("Make Supplier Quotation"),
+ "fieldname": "make_supplier_quotation", "cssClass": "btn-primary" },
]
});
dialog.fields_dict.make_supplier_quotation.$input.click(function() {
- args = dialog.get_values();
+ var args = dialog.get_values();
if(!args) return;
dialog.hide();
return frappe.call({
@@ -117,7 +117,7 @@ frappe.ui.form.on("Request for Quotation Supplier",{
+"&supplier_idx="+encodeURIComponent(child.idx)
+"&no_letterhead=0"));
if(!w) {
- msgprint(__("Please enable pop-ups")); return;
+ frappe.msgprint(__("Please enable pop-ups")); return;
}
}
})
@@ -144,44 +144,44 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e
}
})
}, __("Get items from"));
- // Get items from open Material Requests based on supplier
- this.frm.add_custom_button(__('Possible Supplier'), function() {
- // Create a dialog window for the user to pick their supplier
- var d = new frappe.ui.Dialog({
- title: __('Select Possible Supplier'),
- fields: [
- {fieldname: 'supplier', fieldtype:'Link', options:'Supplier', label:'Supplier', reqd:1},
- {fieldname: 'ok_button', fieldtype:'Button', label:'Get Items from Material Requests'},
- ]
- });
+ // Get items from open Material Requests based on supplier
+ this.frm.add_custom_button(__('Possible Supplier'), function() {
+ // Create a dialog window for the user to pick their supplier
+ var d = new frappe.ui.Dialog({
+ title: __('Select Possible Supplier'),
+ fields: [
+ {fieldname: 'supplier', fieldtype:'Link', options:'Supplier', label:'Supplier', reqd:1},
+ {fieldname: 'ok_button', fieldtype:'Button', label:'Get Items from Material Requests'},
+ ]
+ });
- // On the user clicking the ok button
- d.fields_dict.ok_button.input.onclick = function() {
- var btn = d.fields_dict.ok_button.input;
- var v = d.get_values();
- if(v) {
- $(btn).set_working();
+ // On the user clicking the ok button
+ d.fields_dict.ok_button.input.onclick = function() {
+ var btn = d.fields_dict.ok_button.input;
+ var v = d.get_values();
+ if(v) {
+ $(btn).set_working();
- erpnext.utils.map_current_doc({
- method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier",
- source_name: v.supplier,
- target: me.frm,
- setters: {
- company: me.frm.doc.company
- },
- get_query_filters: {
- material_request_type: "Purchase",
- docstatus: 1,
- status: ["!=", "Stopped"],
- per_ordered: ["<", 99.99]
- }
- });
- $(btn).done_working();
- d.hide();
- }
+ erpnext.utils.map_current_doc({
+ method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_item_from_material_requests_based_on_supplier",
+ source_name: v.supplier,
+ target: me.frm,
+ setters: {
+ company: me.frm.doc.company
+ },
+ get_query_filters: {
+ material_request_type: "Purchase",
+ docstatus: 1,
+ status: ["!=", "Stopped"],
+ per_ordered: ["<", 99.99]
+ }
+ });
+ $(btn).done_working();
+ d.hide();
}
- d.show();
- }, __("Get items from"));
+ }
+ d.show();
+ }, __("Get items from"));
}
},
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 7e5e0458129..c7df33d9f19 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -2,10 +2,10 @@
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Supplier", {
- setup: function(frm) {
- frm.set_query('default_price_list', { 'buying': 1});
- frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
- var d = locals[cdt][cdn];
+ setup: function (frm) {
+ frm.set_query('default_price_list', { 'buying': 1 });
+ frm.set_query('account', 'accounts', function (doc, cdt, cdn) {
+ var d = locals[cdt][cdn];
return {
filters: {
'account_type': 'Payable',
@@ -15,30 +15,30 @@ frappe.ui.form.on("Supplier", {
}
});
},
- refresh: function(frm) {
- frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Supplier'}
+ refresh: function (frm) {
+ frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Supplier' }
- if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
+ if (frappe.defaults.get_default("supp_master_name") != "Naming Series") {
frm.toggle_display("naming_series", false);
} else {
erpnext.toggle_naming_series();
}
- if(frm.doc.__islocal){
- hide_field(['address_html','contact_html']);
+ if (frm.doc.__islocal) {
+ hide_field(['address_html', 'contact_html']);
frappe.geo.clear_address_and_contact(frm);
}
else {
- unhide_field(['address_html','contact_html']);
+ unhide_field(['address_html', 'contact_html']);
frappe.geo.render_address_and_contact(frm);
// custom buttons
- frm.add_custom_button(__('Accounting Ledger'), function() {
+ frm.add_custom_button(__('Accounting Ledger'), function () {
frappe.set_route('query-report', 'General Ledger',
- {party_type:'Supplier', party:frm.doc.name});
+ { party_type: 'Supplier', party: frm.doc.name });
});
- frm.add_custom_button(__('Accounts Payable'), function() {
- frappe.set_route('query-report', 'Accounts Payable', {supplier:frm.doc.name});
+ frm.add_custom_button(__('Accounts Payable'), function () {
+ frappe.set_route('query-report', 'Accounts Payable', { supplier: frm.doc.name });
});
// indicators
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index 6bcbdbacac8..3767248e369 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -5,7 +5,7 @@
{% include 'erpnext/public/js/controllers/buying.js' %};
frappe.ui.form.on('Suppier Quotation', {
- setup: function() {
+ setup: function(frm) {
frm.custom_make_buttons = {
'Purchase Order': 'Purchase Order'
}
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
index 10d13213986..de3d337c344 100644
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
@@ -10,7 +10,6 @@ frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
new erpnext.PurchaseAnalytics(wrapper);
-
frappe.breadcrumbs.add("Buying");
}
@@ -18,7 +17,6 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
init: function(wrapper) {
this._super({
title: __("Purchase Analytics"),
- page: wrapper,
parent: $(wrapper).find('.layout-main'),
page: wrapper.page,
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
@@ -193,13 +191,13 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
},
prepare_balances: function() {
var me = this;
- var from_date = dateutil.str_to_obj(this.from_date);
- var to_date = dateutil.str_to_obj(this.to_date);
+ var from_date = frappe.datetime.str_to_obj(this.from_date);
+ var to_date = frappe.datetime.str_to_obj(this.to_date);
var is_val = this.value_or_qty == 'Value';
$.each(this.tl[this.based_on], function(i, tl) {
if (me.is_default('company') ? true : tl.company === me.company) {
- var posting_date = dateutil.str_to_obj(tl.posting_date);
+ var posting_date = frappe.datetime.str_to_obj(tl.posting_date);
if (posting_date >= from_date && posting_date <= to_date) {
var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
me.item_by_name['Not Set'];
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
index f7fe90fe461..83d25d80ba2 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
@@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
frappe.query_reports["Purchase Order Trends"] = {
- filters: get_filters()
+ filters: erpnext.get_purchase_trends_filters()
}
});
\ No newline at end of file
diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js
index 9b0b2437185..ad6ea7d7f89 100644
--- a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js
+++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js
@@ -3,30 +3,26 @@
frappe.query_reports["Quoted Item Comparison"] = {
"filters": [
- {
- "fieldname":"supplier_quotation",
- "label": __("Supplier Quotation"),
- "fieldtype": "Link",
- "options": "Supplier Quotation",
- "default": "",
- "get_query": function() {
- return {
- filters: {"docstatus": ["<",2]}
- }
+ {
+ "fieldname": "supplier_quotation",
+ "label": __("Supplier Quotation"),
+ "fieldtype": "Link",
+ "options": "Supplier Quotation",
+ "default": "",
+ "get_query": function () {
+ return { filters: { "docstatus": ["<", 2] } }
}
-
-
- },{
- "fieldname":"item",
- "label": __("Item"),
- "fieldtype": "Link",
- "options": "Item",
- "default": "",
- "reqd": 1,
- "get_query": function() {
+ },
+ {
+ "fieldname": "item",
+ "label": __("Item"),
+ "fieldtype": "Link",
+ "options": "Item",
+ "default": "",
+ "reqd": 1,
+ "get_query": function () {
var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value();
- if (quote != "")
- {
+ if (quote != "") {
return {
query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
filters: {
@@ -35,79 +31,74 @@ frappe.query_reports["Quoted Item Comparison"] = {
}
}
}
- else{
- return{
- filters: {"disabled":0}
+ else {
+ return {
+ filters: { "disabled": 0 }
}
}
}
- }
+ }
],
- onload: function(report) {
- //Create a button for setting the default supplier
- report.page.add_inner_button(__("Select Default Supplier"), function() {
+ onload: function (report) {
+ // Create a button for setting the default supplier
+ report.page.add_inner_button(__("Select Default Supplier"), function () {
var reporter = frappe.query_reports["Quoted Item Comparison"];
-
+
//Always make a new one so that the latest values get updated
reporter.make_default_supplier_dialog(report);
report.dialog.show();
- setTimeout(function() { report.dialog.input.focus(); }, 1000);
-
+ setTimeout(function () { report.dialog.input.focus(); }, 1000);
+
}, 'Tools');
-
+
},
"make_default_supplier_dialog": function (report) {
- //Get the name of the item to change
+ // Get the name of the item to change
var filters = report.get_values();
var item_code = filters.item;
-
- //Get a list of the suppliers (with a blank as well) for the user to select
+
+ // Get a list of the suppliers (with a blank as well) for the user to select
var select_options = "";
- for (let supplier of report.data)
- {
- select_options += supplier.supplier_name+ '\n'
+ for (let supplier of report.data) {
+ select_options += supplier.supplier_name + '\n'
}
-
- //Create a dialog window for the user to pick their supplier
+
+ // Create a dialog window for the user to pick their supplier
var d = new frappe.ui.Dialog({
title: __('Select Default Supplier'),
fields: [
- {fieldname: 'supplier', fieldtype:'Select', label:'Supplier', reqd:1,options:select_options},
- {fieldname: 'ok_button', fieldtype:'Button', label:'Set Default Supplier'},
+ { fieldname: 'supplier', fieldtype: 'Select', label: 'Supplier', reqd: 1, options: select_options },
+ { fieldname: 'ok_button', fieldtype: 'Button', label: 'Set Default Supplier' },
]
});
-
- //On the user clicking the ok button
- d.fields_dict.ok_button.input.onclick = function() {
+
+ // On the user clicking the ok button
+ d.fields_dict.ok_button.input.onclick = function () {
var btn = d.fields_dict.ok_button.input;
var v = report.dialog.get_values();
- if(v) {
+ if (v) {
$(btn).set_working();
-
- //Set the default_supplier field of the appropriate Item to the selected supplier
+
+ // Set the default_supplier field of the appropriate Item to the selected supplier
frappe.call({
method: "frappe.client.set_value",
args: {
- doctype: "Item",
+ doctype: "Item",
name: item_code,
fieldname: "default_supplier",
- value: v.supplier,
+ value: v.supplier,
},
- callback: function (r){
+ callback: function (r) {
$(btn).done_working();
- msgprint("Successfully Set Supplier");
+ frappe.msgprint("Successfully Set Supplier");
report.dialog.hide();
-
}
});
}
}
report.dialog = d;
-
-
}
-
}
diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js
index 7e221254ff5..36aa18677f3 100644
--- a/erpnext/crm/doctype/lead/lead.js
+++ b/erpnext/crm/doctype/lead/lead.js
@@ -7,34 +7,35 @@ cur_frm.email_field = "email_id";
erpnext.LeadController = frappe.ui.form.Controller.extend({
setup: function() {
this.frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
- return { query: "erpnext.controllers.queries.customer_query" } }
+ return { query: "erpnext.controllers.queries.customer_query" } }
},
onload: function() {
if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) {
- return { query:"frappe.core.doctype.user.user.user_query" } }
+ return { query: "frappe.core.doctype.user.user.user_query" }
+ }
}
if(cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) {
- return { query:"frappe.core.doctype.user.user.user_query" } }
+ return { query: "frappe.core.doctype.user.user.user_query" } }
}
},
refresh: function() {
var doc = this.frm.doc;
erpnext.toggle_naming_series();
- frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'name', doctype: 'Lead'}
+ frappe.dynamic_link = {doc: doc, fieldname: 'name', doctype: 'Lead'}
- if(!this.frm.doc.__islocal && this.frm.doc.__onload && !this.frm.doc.__onload.is_customer) {
+ if(!doc.__islocal && doc.__onload && !doc.__onload.is_customer) {
this.frm.add_custom_button(__("Customer"), this.create_customer, __("Make"));
this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make"));
this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
- if(!this.frm.doc.__islocal) {
+ if(!doc.__islocal) {
frappe.geo.render_address_and_contact(cur_frm);
} else {
frappe.geo.clear_address_and_contact(cur_frm);
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 974b23e69ad..d25c87b50d4 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -107,7 +107,8 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
$.each([["lead", "lead"],
["customer", "customer"],
- ["contact_person", "contact_query"]], function(i, opts) {
+ ["contact_person", "contact_query"]],
+ function(i, opts) {
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
});
},
@@ -157,7 +158,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
$.each(r.message, function(k, v) {
frappe.model.set_value(cdt, cdn, k, v);
});
- refresh_field('image_view', d.name, 'items');
+ refresh_field('image_view', d.name, 'items');
}
}
})
@@ -184,7 +185,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
});
dialog.fields_dict.update.$input.click(function() {
- args = dialog.get_values();
+ var args = dialog.get_values();
if(!args) return;
return cur_frm.call({
doc: cur_frm.doc,
@@ -192,7 +193,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
args: args.reason,
callback: function(r) {
if(r.exc) {
- msgprint(__("There were errors."));
+ frappe.msgprint(__("There were errors."));
} else {
dialog.hide();
cur_frm.refresh();
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
index 2b25f1dfba2..0bc77a3f2a8 100644
--- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
@@ -1,19 +1,19 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Campaign Efficiency"] = {
- "filters": [
- {
- "fieldname": "from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
- "default": frappe.defaults.get_user_default("year_start_date"),
- },
- {
- "fieldname": "to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
- "default": frappe.defaults.get_user_default("year_end_date"),
- }
- ]
- };
+ "filters": [
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_start_date"),
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
+ "default": frappe.defaults.get_user_default("year_end_date"),
+ }
+ ]
+};
diff --git a/erpnext/crm/report/minutes_to_first_response_for_opportunity/minutes_to_first_response_for_opportunity.js b/erpnext/crm/report/minutes_to_first_response_for_opportunity/minutes_to_first_response_for_opportunity.js
index b1e4917129f..d9c4c8b7fc8 100644
--- a/erpnext/crm/report/minutes_to_first_response_for_opportunity/minutes_to_first_response_for_opportunity.js
+++ b/erpnext/crm/report/minutes_to_first_response_for_opportunity/minutes_to_first_response_for_opportunity.js
@@ -2,40 +2,40 @@
// For license information, please see license.txt
frappe.query_reports["Minutes to First Response for Opportunity"] = {
- "filters": [
- {
- "fieldname":"from_date",
- "label": __("From Date"),
- "fieldtype": "Date",
+ "filters": [
+ {
+ "fieldname": "from_date",
+ "label": __("From Date"),
+ "fieldtype": "Date",
'reqd': 1,
- "default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
- },
- {
- "fieldname":"to_date",
- "label": __("To Date"),
- "fieldtype": "Date",
+ "default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
+ },
+ {
+ "fieldname": "to_date",
+ "label": __("To Date"),
+ "fieldtype": "Date",
'reqd': 1,
- "default":frappe.datetime.nowdate()
- },
- ],
- get_chart_data: function(columns, result) {
+ "default": frappe.datetime.nowdate()
+ },
+ ],
+ get_chart_data: function (columns, result) {
return {
data: {
x: 'Date',
columns: [
- ['Date'].concat($.map(result, function(d) { return d[0]; })),
- ['Mins to first response'].concat($.map(result, function(d) { return d[1]; }))
+ ['Date'].concat($.map(result, function (d) { return d[0]; })),
+ ['Mins to first response'].concat($.map(result, function (d) { return d[1]; }))
]
// rows: [['Date', 'Mins to first response']].concat(result)
},
- axis: {
- x: {
- type: 'timeseries',
- tick: {
- format: frappe.ui.py_date_format
- }
- }
- },
+ axis: {
+ x: {
+ type: 'timeseries',
+ tick: {
+ format: frappe.ui.py_date_format
+ }
+ }
+ },
chart_type: 'line',
}
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 728e5c2f2c0..64d6f40e0e8 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -46,11 +46,11 @@ cur_frm.cscript.score = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if (d.score){
if (flt(d.score) > 5) {
- msgprint(__("Score must be less than or equal to 5"));
+ frappe.msgprint(__("Score must be less than or equal to 5"));
d.score = 0;
refresh_field('score', d.name, 'goals');
}
- total = flt(d.per_weightage*d.score)/100;
+ var total = flt(d.per_weightage*d.score)/100;
d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'goals');
}
diff --git a/erpnext/hr/doctype/attendance/attendance.js b/erpnext/hr/doctype/attendance/attendance.js
index 7f2b18f0e4c..c3c3cb82f94 100644
--- a/erpnext/hr/doctype/attendance/attendance.js
+++ b/erpnext/hr/doctype/attendance/attendance.js
@@ -5,7 +5,7 @@ cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
cur_frm.cscript.onload = function(doc, cdt, cdn) {
- if(doc.__islocal) cur_frm.set_value("attendance_date", get_today());
+ if(doc.__islocal) cur_frm.set_value("attendance_date", frappe.datetime.get_today());
}
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
index c0c0ef0fe04..376d0c0a5a5 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
@@ -5,7 +5,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
onload: function(frm) {
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
- frm.set_value("date", get_today());
+ frm.set_value("date", frappe.datetime.get_today());
erpnext.employee_attendance_tool.load_employees(frm);
},
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.js b/erpnext/hr/doctype/employee_loan/employee_loan.js
index 71b6356ef66..9720bcba63c 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan.js
+++ b/erpnext/hr/doctype/employee_loan/employee_loan.js
@@ -2,8 +2,8 @@
// For license information, please see license.txt
frappe.ui.form.on('Employee Loan', {
- onload: function(frm) {
- frm.set_query("employee_loan_application", function() {
+ onload: function (frm) {
+ frm.set_query("employee_loan_application", function () {
return {
"filters": {
"employee": frm.doc.employee,
@@ -12,19 +12,19 @@ frappe.ui.form.on('Employee Loan', {
}
};
});
-
- frm.set_query("interest_income_account", function() {
+
+ frm.set_query("interest_income_account", function () {
return {
"filters": {
- "company": frm.doc.company,
- "root_type": "Income",
- "is_group": 0
+ "company": frm.doc.company,
+ "root_type": "Income",
+ "is_group": 0
}
};
});
- $.each(["payment_account", "employee_loan_account"], function(i, field) {
- frm.set_query(field, function() {
+ $.each(["payment_account", "employee_loan_account"], function (i, field) {
+ frm.set_query(field, function () {
return {
"filters": {
"company": frm.doc.company,
@@ -36,16 +36,16 @@ frappe.ui.form.on('Employee Loan', {
})
},
- refresh: function(frm) {
+ refresh: function (frm) {
if (frm.doc.docstatus == 1 && (frm.doc.status == "Sanctioned" || frm.doc.status == "Partially Disbursed")) {
- frm.add_custom_button(__('Make Disbursement Entry'), function() {
+ frm.add_custom_button(__('Make Disbursement Entry'), function () {
frm.trigger("make_jv");
})
}
frm.trigger("toggle_fields");
},
- make_jv: function(frm) {
+ make_jv: function (frm) {
frappe.call({
args: {
"employee_loan": frm.doc.name,
@@ -56,36 +56,36 @@ frappe.ui.form.on('Employee Loan', {
"payment_account": frm.doc.payment_account
},
method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry",
- callback: function(r) {
+ callback: function (r) {
if (r.message)
var doc = frappe.model.sync(r.message)[0];
- frappe.set_route("Form", doc.doctype, doc.name);
+ frappe.set_route("Form", doc.doctype, doc.name);
}
})
},
- mode_of_payment: function(frm) {
+ mode_of_payment: function (frm) {
frappe.call({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
args: {
"mode_of_payment": frm.doc.mode_of_payment,
"company": frm.doc.company
},
- callback: function(r, rt) {
- if(r.message) {
+ callback: function (r, rt) {
+ if (r.message) {
frm.set_value("payment_account", r.message.account);
}
}
});
},
- employee_loan_application: function(frm) {
+ employee_loan_application: function (frm) {
return frappe.call({
method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
args: {
"employee_loan_application": frm.doc.employee_loan_application
},
- callback: function(r){
- if(!r.exc && r.message) {
+ callback: function (r) {
+ if (!r.exc && r.message) {
frm.set_value("loan_type", r.message.loan_type);
frm.set_value("loan_amount", r.message.loan_amount);
frm.set_value("repayment_method", r.message.repayment_method);
@@ -97,12 +97,12 @@ frappe.ui.form.on('Employee Loan', {
})
},
- repayment_method: function(frm) {
+ repayment_method: function (frm) {
frm.trigger("toggle_fields")
},
- toggle_fields: function(frm) {
- frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method=="Repay Fixed Amount per Period")
- frm.toggle_enable("repayment_periods", frm.doc.repayment_method=="Repay Over Number of Periods")
+ toggle_fields: function (frm) {
+ frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method == "Repay Fixed Amount per Period")
+ frm.toggle_enable("repayment_periods", frm.doc.repayment_method == "Repay Over Number of Periods")
}
});
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 95877cf0322..4ce91c4bf9b 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -52,7 +52,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
cur_frm.set_value("approval_status", "Draft")
if (doc.__islocal) {
- cur_frm.set_value("posting_date", dateutil.get_today());
+ cur_frm.set_value("posting_date", frappe.datetime.get_today());
if(doc.amended_from)
cur_frm.set_value("approval_status", "Draft");
cur_frm.cscript.clear_sanctioned(doc);
@@ -81,15 +81,15 @@ cur_frm.cscript.clear_sanctioned = function(doc) {
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']);
}
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
+cur_frm.cscript.refresh = function(doc,cdt,cdn) {
cur_frm.cscript.set_help(doc);
if(!doc.__islocal) {
cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft");
- cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0));
+ cur_frm.toggle_enable("approval_status", (doc.exp_approver==frappe.session.user && doc.docstatus==0));
- if (doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
- cur_frm.savesubmit();
+ if (doc.docstatus==0 && doc.exp_approver==frappe.session.user && doc.approval_status=="Approved")
+ cur_frm.savesubmit();
if (doc.docstatus===1 && doc.approval_status=="Approved") {
if (cint(doc.total_amount_reimbursed) < cint(doc.total_sanctioned_amount) && frappe.model.can_create("Journal Entry")) {
@@ -97,6 +97,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
}
+ /* eslint-disable */
+ // no idea how `me` works here
if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
cur_frm.add_custom_button(__('Bank Entries'), function() {
frappe.route_options = {
@@ -107,17 +109,18 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
frappe.set_route("List", "Journal Entry");
}, __("View"));
}
+ /* eslint-enable */
}
}
}
cur_frm.cscript.set_help = function(doc) {
cur_frm.set_intro("");
- if(doc.__islocal && !in_list(roles, "HR User")) {
+ if(doc.__islocal && !in_list(frappe.user_roles, "HR User")) {
cur_frm.set_intro(__("Fill the form and save it"))
} else {
if(doc.docstatus==0 && doc.approval_status=="Draft") {
- if(user==doc.exp_approver) {
+ if(frappe.session.user==doc.exp_approver) {
cur_frm.set_intro(__("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
} else {
cur_frm.set_intro(__("Expense Claim is pending approval. Only the Expense Approver can update status."));
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.js b/erpnext/hr/doctype/leave_allocation/leave_allocation.js
index b7e1f45a15c..4b4bfafd161 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.js
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.js
@@ -5,7 +5,7 @@ cur_frm.add_fetch('employee','employee_name','employee_name');
frappe.ui.form.on("Leave Allocation", {
onload: function(frm) {
- if(!frm.doc.from_date) frm.set_value("from_date", get_today());
+ if(!frm.doc.from_date) frm.set_value("from_date", frappe.datetime.get_today());
frm.set_query("employee", function() {
return {
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index 3bf41bb3411..2eb155dee11 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -7,7 +7,7 @@ cur_frm.add_fetch('employee','company','company');
frappe.ui.form.on("Leave Application", {
onload: function(frm) {
if (!frm.doc.posting_date) {
- frm.set_value("posting_date", get_today());
+ frm.set_value("posting_date", frappe.datetime.get_today());
}
frm.set_query("leave_approver", function() {
@@ -76,9 +76,9 @@ frappe.ui.form.on("Leave Application", {
frm.set_value('half_day_date', '');
var half_day_datepicker = frm.fields_dict.half_day_date.datepicker;
half_day_datepicker.update({
- minDate: frappe.datetime.str_to_obj(frm.doc.from_date),
- maxDate: frappe.datetime.str_to_obj(frm.doc.to_date)
- })
+ minDate: frappe.datetime.str_to_obj(frm.doc.from_date),
+ maxDate: frappe.datetime.str_to_obj(frm.doc.to_date)
+ })
},
get_leave_balance: function(frm) {
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
index 3720f2f6361..0eb64144069 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
@@ -1,19 +1,19 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
-cur_frm.cscript.onload = function(doc, dt, dn){
- if(!doc.posting_date)
- set_multiple(dt, dn, {posting_date: get_today()});
- if(!doc.leave_transaction_type)
- set_multiple(dt, dn, {leave_transaction_type: 'Allocation'});
+cur_frm.cscript.onload = function (doc, dt, dn) {
+ if (!doc.posting_date)
+ set_multiple(dt, dn, { posting_date: frappe.datetime.get_today() });
+ if (!doc.leave_transaction_type)
+ set_multiple(dt, dn, { leave_transaction_type: 'Allocation' });
}
-cur_frm.cscript.to_date = function(doc, cdt, cdn) {
- return $c('runserverobj', args={'method':'to_date_validation','docs':doc},
- function(r, rt) {
+cur_frm.cscript.to_date = function (doc, cdt, cdn) {
+ return $c('runserverobj', { 'method': 'to_date_validation', 'docs': doc },
+ function (r, rt) {
var doc = locals[cdt][cdn];
if (r.message) {
- msgprint(__("To date cannot be before from date"));
+ frappe.msgprint(__("To date cannot be before from date"));
doc.to_date = '';
refresh_field('to_date');
}
@@ -21,11 +21,11 @@ cur_frm.cscript.to_date = function(doc, cdt, cdn) {
);
}
-cur_frm.cscript.allocation_type = function (doc, cdt, cdn){
+cur_frm.cscript.allocation_type = function (doc, cdt, cdn) {
doc.no_of_days = '';
refresh_field('no_of_days');
}
-frappe.ui.form.on("Leave Control Panel", "refresh", function(frm) {
+frappe.ui.form.on("Leave Control Panel", "refresh", function (frm) {
frm.disable_save();
});
\ No newline at end of file
diff --git a/erpnext/hr/doctype/offer_letter/offer_letter.js b/erpnext/hr/doctype/offer_letter/offer_letter.js
index 125a425b6cc..c0d397bf219 100755
--- a/erpnext/hr/doctype/offer_letter/offer_letter.js
+++ b/erpnext/hr/doctype/offer_letter/offer_letter.js
@@ -4,18 +4,18 @@
frappe.provide("erpnext.offer_letter");
frappe.ui.form.on("Offer Letter", {
- select_terms: function(frm) {
- erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function(r) {
- if(!r.exc) {
- me.frm.set_value("terms", r.message);
+ select_terms: function (frm) {
+ erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function (r) {
+ if (!r.exc) {
+ frm.set_value("terms", r.message);
}
});
},
- refresh:function(frm){
- if((!frm.doc.__islocal) && (frm.doc.status=='Accepted') && (frm.doc.docstatus===1)){
+ refresh: function (frm) {
+ if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted') && (frm.doc.docstatus === 1)) {
frm.add_custom_button(__('Make Employee'),
- function() {
+ function () {
erpnext.offer_letter.make_employee(frm)
}
);
@@ -24,7 +24,7 @@ frappe.ui.form.on("Offer Letter", {
});
-erpnext.offer_letter.make_employee = function(frm) {
+erpnext.offer_letter.make_employee = function (frm) {
frappe.model.open_mapped_doc({
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
frm: frm
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.js b/erpnext/hr/doctype/process_payroll/process_payroll.js
index e1bea622234..0ec7f7052ff 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.js
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.js
@@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Process Payroll", {
- onload: function(frm) {
+ onload: function (frm) {
frm.doc.posting_date = frappe.datetime.nowdate();
frm.doc.start_date = '';
frm.doc.end_date = '';
@@ -10,8 +10,8 @@ frappe.ui.form.on("Process Payroll", {
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
- setup: function(frm) {
- frm.set_query("payment_account", function() {
+ setup: function (frm) {
+ frm.set_query("payment_account", function () {
var account_types = ["Bank", "Cash"];
return {
filters: {
@@ -21,57 +21,57 @@ frappe.ui.form.on("Process Payroll", {
}
}
}),
- frm.set_query("cost_center", function() {
- return {
- filters: {
- "is_group": 0,
- company: frm.doc.company
+ frm.set_query("cost_center", function () {
+ return {
+ filters: {
+ "is_group": 0,
+ company: frm.doc.company
+ }
}
- }
- }),
- frm.set_query("project", function() {
- return {
- filters: {
- company: frm.doc.company
+ }),
+ frm.set_query("project", function () {
+ return {
+ filters: {
+ company: frm.doc.company
+ }
}
- }
- })
+ })
},
- refresh: function(frm) {
+ refresh: function (frm) {
frm.disable_save();
},
- payroll_frequency: function(frm) {
+ payroll_frequency: function (frm) {
frm.trigger("set_start_end_dates");
},
- start_date: function(frm) {
+ start_date: function (frm) {
frm.trigger("set_start_end_dates");
},
- end_date: function(frm) {
+ end_date: function (frm) {
frm.trigger("set_start_end_dates");
},
- salary_slip_based_on_timesheet: function(frm) {
+ salary_slip_based_on_timesheet: function (frm) {
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
- payment_account: function(frm) {
- frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account!="" && frm.doc.payment_account!="undefined"));
+ payment_account: function (frm) {
+ frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account != "" && frm.doc.payment_account != "undefined"));
},
- set_start_end_dates: function(frm) {
- if (!frm.doc.salary_slip_based_on_timesheet){
+ set_start_end_dates: function (frm) {
+ if (!frm.doc.salary_slip_based_on_timesheet) {
frappe.call({
- method:'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates',
- args:{
+ method: 'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates',
+ args: {
payroll_frequency: frm.doc.payroll_frequency,
start_date: frm.doc.start_date || frm.doc.posting_date
},
- callback: function(r){
- if (r.message){
+ callback: function (r) {
+ if (r.message) {
frm.set_value('start_date', r.message.start_date);
frm.set_value('end_date', r.message.end_date);
}
@@ -81,60 +81,60 @@ frappe.ui.form.on("Process Payroll", {
},
})
-cur_frm.cscript.display_activity_log = function(msg) {
- if(!cur_frm.ss_html)
- cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
- if(msg) {
+cur_frm.cscript.display_activity_log = function (msg) {
+ if (!cur_frm.ss_html)
+ cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper, 'div');
+ if (msg) {
cur_frm.ss_html.innerHTML =
- '
" +
+ if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
+ var help_msg = "
" +
__("For 'Product Bundle' items, Warehouse, Serial No and Batch No will be considered from the 'Packing List' table. If Warehouse and Batch No are same for all packing items for any 'Product Bundle' item, those values can be entered in the main Item table, values will be copied to 'Packing List' table.")+
"