Lint and fix JS files

This commit is contained in:
Faris Ansari 2017-05-30 12:54:42 +05:30
parent dae7721384
commit ab74ca7fff
138 changed files with 1280 additions and 1268 deletions

View File

@ -2,26 +2,26 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function (doc, cdt, cdn) {
if(doc.__islocal) { if (doc.__islocal) {
msgprint(__("Please create new account from Chart of Accounts.")); frappe.msgprint(__("Please create new account from Chart of Accounts."));
throw "cannot create"; throw "cannot create";
} }
cur_frm.toggle_display('account_name', doc.__islocal); cur_frm.toggle_display('account_name', doc.__islocal);
// hide fields if group // hide fields if group
cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group)==0) cur_frm.toggle_display(['account_type', 'tax_rate'], cint(doc.is_group) == 0)
// disable fields // disable fields
cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false); cur_frm.toggle_enable(['account_name', 'is_group', 'company'], false);
if(cint(doc.is_group)==0) { if (cint(doc.is_group) == 0) {
cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account); cur_frm.toggle_display('freeze_account', doc.__onload && doc.__onload.can_freeze_account);
} }
// read-only for root accounts // read-only for root accounts
if(!doc.parent_account) { if (!doc.parent_account) {
cur_frm.set_read_only(); cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root account and cannot be edited.")); cur_frm.set_intro(__("This is a root account and cannot be edited."));
} else { } else {
@ -38,53 +38,53 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.add_fetch('parent_account', 'report_type', 'report_type'); cur_frm.add_fetch('parent_account', 'report_type', 'report_type');
cur_frm.add_fetch('parent_account', 'root_type', 'root_type'); cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
cur_frm.cscript.account_type = function(doc, cdt, cdn) { cur_frm.cscript.account_type = function (doc, cdt, cdn) {
if(doc.is_group==0) { if (doc.is_group == 0) {
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax'); cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
cur_frm.toggle_display('warehouse', doc.account_type=='Stock'); cur_frm.toggle_display('warehouse', doc.account_type == 'Stock');
} }
} }
cur_frm.cscript.add_toolbar_buttons = function(doc) { cur_frm.cscript.add_toolbar_buttons = function (doc) {
cur_frm.add_custom_button(__('Chart of Accounts'), cur_frm.add_custom_button(__('Chart of Accounts'),
function() { frappe.set_route("Tree", "Account"); }); function () { frappe.set_route("Tree", "Account"); });
if (doc.is_group == 1) { if (doc.is_group == 1) {
cur_frm.add_custom_button(__('Group to Non-Group'), cur_frm.add_custom_button(__('Group to Non-Group'),
function() { cur_frm.cscript.convert_to_ledger(); }, 'fa fa-retweet', 'btn-default'); function () { cur_frm.cscript.convert_to_ledger(); }, 'fa fa-retweet', 'btn-default');
} else if (cint(doc.is_group) == 0) { } else if (cint(doc.is_group) == 0) {
cur_frm.add_custom_button(__('Ledger'), function() { cur_frm.add_custom_button(__('Ledger'), function () {
frappe.route_options = { frappe.route_options = {
"account": doc.name, "account": doc.name,
"from_date": sys_defaults.year_start_date, "from_date": frappe.sys_defaults.year_start_date,
"to_date": sys_defaults.year_end_date, "to_date": frappe.sys_defaults.year_end_date,
"company": doc.company "company": doc.company
}; };
frappe.set_route("query-report", "General Ledger"); frappe.set_route("query-report", "General Ledger");
}); });
cur_frm.add_custom_button(__('Non-Group to Group'), cur_frm.add_custom_button(__('Non-Group to Group'),
function() { cur_frm.cscript.convert_to_group(); }, 'fa fa-retweet', 'btn-default') function () { cur_frm.cscript.convert_to_group(); }, 'fa fa-retweet', 'btn-default')
} }
} }
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) { cur_frm.cscript.convert_to_ledger = function (doc, cdt, cdn) {
return $c_obj(cur_frm.doc,'convert_group_to_ledger','',function(r,rt) { return $c_obj(cur_frm.doc, 'convert_group_to_ledger', '', function (r, rt) {
if(r.message == 1) { if (r.message == 1) {
cur_frm.refresh(); cur_frm.refresh();
} }
}); });
} }
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) { cur_frm.cscript.convert_to_group = function (doc, cdt, cdn) {
return $c_obj(cur_frm.doc,'convert_ledger_to_group','',function(r,rt) { return $c_obj(cur_frm.doc, 'convert_ledger_to_group', '', function (r, rt) {
if(r.message == 1) { if (r.message == 1) {
cur_frm.refresh(); cur_frm.refresh();
} }
}); });
} }
cur_frm.fields_dict['parent_account'].get_query = function(doc) { cur_frm.fields_dict['parent_account'].get_query = function (doc) {
return { return {
filters: { filters: {
"is_group": 1, "is_group": 1,

View File

@ -72,8 +72,8 @@ frappe.treeview_settings["Account"] = {
click: function(node, btn) { click: function(node, btn) {
frappe.route_options = { frappe.route_options = {
"account": node.label, "account": node.label,
"from_date": sys_defaults.year_start_date, "from_date": frappe.sys_defaults.year_start_date,
"to_date": sys_defaults.year_end_date, "to_date": frappe.sys_defaults.year_end_date,
"company": frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): "" "company": frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
}; };
frappe.set_route("query-report", "General Ledger"); frappe.set_route("query-report", "General Ledger");

View File

@ -75,7 +75,7 @@ frappe.ui.form.on('Asset', {
$.each(frm.doc.schedules || [], function(i, v) { $.each(frm.doc.schedules || [], function(i, v) {
x_intervals.push(v.schedule_date); x_intervals.push(v.schedule_date);
asset_value = flt(frm.doc.gross_purchase_amount) - flt(v.accumulated_depreciation_amount); var asset_value = flt(frm.doc.gross_purchase_amount) - flt(v.accumulated_depreciation_amount);
if(v.journal_entry) { if(v.journal_entry) {
last_depreciation_date = v.schedule_date; last_depreciation_date = v.schedule_date;
asset_values.push(asset_value) asset_values.push(asset_value)
@ -187,7 +187,7 @@ frappe.ui.form.on('Depreciation Schedule', {
erpnext.asset.set_accululated_depreciation = function(frm) { erpnext.asset.set_accululated_depreciation = function(frm) {
if(frm.doc.depreciation_method != "Manual") return; if(frm.doc.depreciation_method != "Manual") return;
accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation); var accumulated_depreciation = flt(frm.doc.opening_accumulated_depreciation);
$.each(frm.doc.schedules || [], function(i, row) { $.each(frm.doc.schedules || [], function(i, row) {
accumulated_depreciation += flt(row.depreciation_amount); accumulated_depreciation += flt(row.depreciation_amount);
frappe.model.set_value(row.doctype, row.name, frappe.model.set_value(row.doctype, row.name,
@ -285,7 +285,7 @@ erpnext.asset.transfer_asset = function(frm) {
}); });
dialog.set_primary_action(__("Transfer"), function() { dialog.set_primary_action(__("Transfer"), function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
dialog.hide(); dialog.hide();
return frappe.call({ return frappe.call({

View File

@ -20,11 +20,11 @@ frappe.ui.form.on('Bank Guarantee', {
}); });
}, },
start_date: function(frm) { start_date: function(frm) {
end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1); var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
cur_frm.set_value("end_date", end_date); cur_frm.set_value("end_date", end_date);
}, },
validity: function(frm) { validity: function(frm) {
end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1); var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
cur_frm.set_value("end_date", end_date); cur_frm.set_value("end_date", end_date);
} }
}); });

View File

@ -43,7 +43,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) { cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
if(!doc.company){ if(!doc.company){
msgprint(__('Please enter company name first')); frappe.msgprint(__('Please enter company name first'));
} }
} }

View File

@ -13,7 +13,7 @@ $.extend(cur_frm.cscript, {
this.frm.toggle_enable('year_start_date', doc.__islocal) this.frm.toggle_enable('year_start_date', doc.__islocal)
this.frm.toggle_enable('year_end_date', doc.__islocal) this.frm.toggle_enable('year_end_date', doc.__islocal)
if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) { if (!doc.__islocal && (doc.name != frappe.sys_defaults.fiscal_year)) {
this.frm.add_custom_button(__("Default"), this.frm.add_custom_button(__("Default"),
this.frm.cscript.set_as_default, "fa fa-star"); this.frm.cscript.set_as_default, "fa fa-star");
this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'")); this.frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
@ -30,7 +30,7 @@ $.extend(cur_frm.cscript, {
year_start_date: function(doc, dt, dn) { year_start_date: function(doc, dt, dn) {
var me = this; var me = this;
year_end_date = var year_end_date =
frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1); frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
this.frm.set_value("year_end_date", year_end_date); this.frm.set_value("year_end_date", year_end_date);
}, },

View File

@ -63,10 +63,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
frappe.model.set_default_values(this.frm.doc); frappe.model.set_default_values(this.frm.doc);
$.each(this.frm.doc.accounts || [], function(i, jvd) { $.each(this.frm.doc.accounts || [], function(i, jvd) {
frappe.model.set_default_values(jvd); frappe.model.set_default_values(jvd);
} });
);
if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || get_today(); if(!this.frm.doc.amended_from) this.frm.doc.posting_date = this.frm.posting_date || frappe.datetime.get_today();
} }
}, },
@ -124,7 +123,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
// account filter // account filter
frappe.model.validate_missing(jvd, "account"); frappe.model.validate_missing(jvd, "account");
party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to"; var party_account_field = jvd.reference_type==="Sales Invoice" ? "debit_to": "credit_to";
out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]); out.filters.push([jvd.reference_type, party_account_field, "=", jvd.account]);
} else { } else {
// party_type and party mandatory // party_type and party mandatory

View File

@ -7,7 +7,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
refresh_field('percentages'); refresh_field('percentages');
} }
return $c('runserverobj',args={'method':'get_months', 'docs':doc}, callback1); return $c('runserverobj', {'method':'get_months', 'docs':doc}, callback1);
} }
} }

View File

@ -183,7 +183,7 @@ frappe.ui.form.on('Payment Entry', {
$.each(["party", "party_balance", "paid_from", "paid_to", $.each(["party", "party_balance", "paid_from", "paid_to",
"references", "total_allocated_amount"], function(i, field) { "references", "total_allocated_amount"], function(i, field) {
frm.set_value(field, null); frm.set_value(field, null);
}) });
} else { } else {
if(!frm.doc.party) if(!frm.doc.party)
frm.set_value("party_type", frm.doc.payment_type=="Receive" ? "Customer" : "Supplier"); frm.set_value("party_type", frm.doc.payment_type=="Receive" ? "Customer" : "Supplier");
@ -200,7 +200,8 @@ frappe.ui.form.on('Payment Entry', {
$.each(["party", "party_balance", "paid_from", "paid_to", $.each(["party", "party_balance", "paid_from", "paid_to",
"paid_from_account_currency", "paid_from_account_balance", "paid_from_account_currency", "paid_from_account_balance",
"paid_to_account_currency", "paid_to_account_balance", "paid_to_account_currency", "paid_to_account_balance",
"references", "total_allocated_amount"], function(i, field) { "references", "total_allocated_amount"],
function(i, field) {
frm.set_value(field, null); frm.set_value(field, null);
}) })
} }
@ -487,13 +488,17 @@ frappe.ui.form.on('Payment Entry', {
} }
}); });
if((frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") || if(
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier")) { (frm.doc.payment_type=="Receive" && frm.doc.party_type=="Customer") ||
(frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier")
) {
if(total_positive_outstanding > total_negative_outstanding) if(total_positive_outstanding > total_negative_outstanding)
frm.set_value("paid_amount", frm.set_value("paid_amount",
total_positive_outstanding - total_negative_outstanding); total_positive_outstanding - total_negative_outstanding);
} else if (total_negative_outstanding && } else if (
(total_positive_outstanding < total_negative_outstanding)) { total_negative_outstanding &&
total_positive_outstanding < total_negative_outstanding
) {
frm.set_value("received_amount", frm.set_value("received_amount",
total_negative_outstanding - total_positive_outstanding); total_negative_outstanding - total_positive_outstanding);
} }
@ -561,9 +566,11 @@ frappe.ui.form.on('Payment Entry', {
row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount
if(frm.doc.allocate_payment_amount){ if(frm.doc.allocate_payment_amount){
if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) { if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) {
if(row.outstanding_amount >= allocated_positive_outstanding) if(row.outstanding_amount >= allocated_positive_outstanding) {
row.allocated_amount = allocated_positive_outstanding; row.allocated_amount = allocated_positive_outstanding;
else row.allocated_amount = row.outstanding_amount; } else {
row.allocated_amount = row.outstanding_amount;
}
allocated_positive_outstanding -= flt(row.allocated_amount); allocated_positive_outstanding -= flt(row.allocated_amount);
} else if (row.outstanding_amount < 0 && allocated_negative_outstanding) { } else if (row.outstanding_amount < 0 && allocated_negative_outstanding) {
@ -581,7 +588,8 @@ frappe.ui.form.on('Payment Entry', {
}, },
set_total_allocated_amount: function(frm) { set_total_allocated_amount: function(frm) {
var total_allocated_amount = base_total_allocated_amount = 0.0; var total_allocated_amount = 0.0;
var base_total_allocated_amount = 0.0;
$.each(frm.doc.references || [], function(i, row) { $.each(frm.doc.references || [], function(i, row) {
if (row.allocated_amount) { if (row.allocated_amount) {
total_allocated_amount += flt(row.allocated_amount); total_allocated_amount += flt(row.allocated_amount);
@ -653,15 +661,17 @@ frappe.ui.form.on('Payment Entry', {
return; return;
} }
if(frm.doc.party_type=="Customer" if(frm.doc.party_type=="Customer" &&
&& !in_list(["Sales Order", "Sales Invoice", "Journal Entry"], row.reference_doctype)) { !in_list(["Sales Order", "Sales Invoice", "Journal Entry"], row.reference_doctype)
) {
frappe.model.set_value(row.doctype, row.name, "reference_doctype", null); frappe.model.set_value(row.doctype, row.name, "reference_doctype", null);
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Sales Order, Sales Invoice or Journal Entry", [row.idx])); frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Sales Order, Sales Invoice or Journal Entry", [row.idx]));
return false; return false;
} }
if(frm.doc.party_type=="Supplier" && !in_list(["Purchase Order", if(frm.doc.party_type=="Supplier" &&
"Purchase Invoice", "Journal Entry"], row.reference_doctype)) { !in_list(["Purchase Order", "Purchase Invoice", "Journal Entry"], row.reference_doctype)
) {
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", null); frappe.model.set_value(row.doctype, row.name, "against_voucher_type", null);
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Purchase Order, Purchase Invoice or Journal Entry", [row.idx])); frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Purchase Order, Purchase Invoice or Journal Entry", [row.idx]));
return false; return false;

View File

@ -14,7 +14,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
this.frm.set_query('receivable_payable_account', function() { this.frm.set_query('receivable_payable_account', function() {
if(!me.frm.doc.company || !me.frm.doc.party_type) { if(!me.frm.doc.company || !me.frm.doc.party_type) {
msgprint(__("Please select Company and Party Type first")); frappe.msgprint(__("Please select Company and Party Type first"));
} else { } else {
return{ return{
filters: { filters: {
@ -29,7 +29,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
this.frm.set_query('bank_cash_account', function() { this.frm.set_query('bank_cash_account', function() {
if(!me.frm.doc.company) { if(!me.frm.doc.company) {
msgprint(__("Please select Company first")); frappe.msgprint(__("Please select Company first"));
} else { } else {
return{ return{
filters:[ filters:[
@ -96,10 +96,11 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
}, },
set_invoice_options: function() { set_invoice_options: function() {
var me = this;
var invoices = []; var invoices = [];
$.each(me.frm.doc.invoices || [], function(i, row) { $.each(me.frm.doc.invoices || [], function(i, row) {
if (row.invoice_number && !inList(invoices, row.invoice_number)) if (row.invoice_number && !in_list(invoices, row.invoice_number))
invoices.push(row.invoice_type + " | " + row.invoice_number); invoices.push(row.invoice_type + " | " + row.invoice_number);
}); });
@ -108,7 +109,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
me.frm.doc.name).options = "\n" + invoices.join("\n"); me.frm.doc.name).options = "\n" + invoices.join("\n");
$.each(me.frm.doc.payments || [], function(i, p) { $.each(me.frm.doc.payments || [], function(i, p) {
if(!inList(invoices, cstr(p.invoice_number))) p.invoice_number = null; if(!in_list(invoices, cstr(p.invoice_number))) p.invoice_number = null;
}); });
} }

View File

@ -3,7 +3,7 @@
frappe.ui.form.on('Period Closing Voucher', { frappe.ui.form.on('Period Closing Voucher', {
onload: function(frm) { onload: function(frm) {
if (!frm.doc.transaction_date) frm.doc.transaction_date = dateutil.obj_to_str(new Date()); if (!frm.doc.transaction_date) frm.doc.transaction_date = frappe.datetime.obj_to_str(new Date());
}, },
setup: function(frm) { setup: function(frm) {

View File

@ -35,8 +35,8 @@ cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
'company': doc.company, 'company': doc.company,
'account_type': "Income Account" 'account_type': "Income Account"
} }
} };
} };
// Cost Center // Cost Center
@ -47,8 +47,8 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
'company': doc.company, 'company': doc.company,
'is_group': 0 'is_group': 0
} }
} };
} };
// Expense Account // Expense Account
@ -60,8 +60,8 @@ cur_frm.fields_dict["expense_account"].get_query = function(doc) {
"company": doc.company, "company": doc.company,
"is_group": 0 "is_group": 0
} }
} };
} };
// ------------------ Get Print Heading ------------------------------------ // ------------------ Get Print Heading ------------------------------------
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
@ -69,13 +69,13 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
filters:[ filters:[
['Print Heading', 'docstatus', '!=', 2] ['Print Heading', 'docstatus', '!=', 2]
] ]
} };
} };
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) { cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
return{ query:"frappe.core.doctype.user.user.user_query"} return{ query:"frappe.core.doctype.user.user.user_query"};
} };
cur_frm.fields_dict.write_off_account.get_query = function(doc) { cur_frm.fields_dict.write_off_account.get_query = function(doc) {
return{ return{
@ -84,16 +84,16 @@ cur_frm.fields_dict.write_off_account.get_query = function(doc) {
'is_group': 0, 'is_group': 0,
'company': doc.company 'company': doc.company
} }
} };
} };
// Write off cost center // Write off cost center
//----------------------- // -----------------------
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) { cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
return{ return{
filters:{ filters:{
'is_group': 0, 'is_group': 0,
'company': doc.company 'company': doc.company
} }
} };
} };

View File

@ -2,63 +2,65 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Pricing Rule", "refresh", function(frm) { frappe.ui.form.on("Pricing Rule", "refresh", function(frm) {
var help_content = ['<table class="table table-bordered" style="background-color: #f9f9f9;">', var help_content =
'<tr><td>', `<table class="table table-bordered" style="background-color: #f9f9f9;">
'<h4><i class="fa fa-hand-right"></i> ', <tr><td>
__('Notes'), <h4>
':</h4>', <i class="fa fa-hand-right"></i>
'<ul>', ${__('Notes')}
'<li>', </h4>
__("Pricing Rule is made to overwrite Price List / define discount percentage, based on some criteria."), <ul>
'</li>', <li>
'<li>', ${__("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."), </li>
'</li>', <li>
'<li>', ${__("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.'), </li>
'</li>', <li>
'<li>', ${__('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.'), </li>
'</li>', <li>
'</ul>', ${__('To not apply Pricing Rule in a particular transaction, all applicable Pricing Rules should be disabled.')}
'</td></tr>', </li>
'<tr><td>', </ul>
'<h4><i class="fa fa-question-sign"></i> ', </td></tr>
__('How Pricing Rule is applied?'), <tr><td>
'</h4>', <h4><i class="fa fa-question-sign"></i>
'<ol>', ${__('How Pricing Rule is applied?')}
'<li>', </h4>
__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand."), <ol>
'</li>', <li>
'<li>', ${__("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."), </li>
'</li>', <li>
'<li>', ${__("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.'), </li>
'</li>', <li>
'<li>', ${__('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.'), </li>
'</li>', <li>
'<li>', ${__('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:'), </li>
'<ul>', <li>
'<li>', ${__('Even if there are multiple Pricing Rules with highest priority, then following internal priorities are applied:')}
__('Item Code > Item Group > Brand'), <ul>
'</li>', <li>
'<li>', ${__('Item Code > Item Group > Brand')}
__('Customer > Customer Group > Territory'), </li>
'</li>', <li>
'<li>', ${__('Customer > Customer Group > Territory')}
__('Supplier > Supplier Type'), </li>
'</li>', <li>
'</ul>', ${__('Supplier > Supplier Type')}
'</li>', </li>
'<li>', </ul>
__('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.'), </li>
'</li>', <li>
'</ol>', ${__('If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.')}
'</td></tr>', </li>
'</table>'].join("\n"); </ol>
</td></tr>
</table>`;
set_field_options("pricing_rule_help", help_content); set_field_options("pricing_rule_help", help_content);

View File

@ -130,7 +130,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(cint(this.frm.doc.is_paid)) { if(cint(this.frm.doc.is_paid)) {
if(!this.frm.doc.company) { if(!this.frm.doc.company) {
this.frm.set_value("is_paid", 0) this.frm.set_value("is_paid", 0)
msgprint(__("Please specify Company to proceed")); frappe.msgprint(__("Please specify Company to proceed"));
} }
} }
this.calculate_outstanding_amount(); this.calculate_outstanding_amount();
@ -195,19 +195,19 @@ cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
// Hide Fields // Hide Fields
// ------------ // ------------
function hide_fields(doc) { 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) { if(cint(doc.is_paid) == 1) {
hide_field(parent_fields); hide_field(parent_fields);
} else { } else {
for (i in parent_fields) { for (var i in parent_fields) {
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]]; var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
if(!docfield.hidden) unhide_field(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, cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false)); (cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false));

View File

@ -9,11 +9,11 @@ frappe.ui.form.on("Purchase Taxes and Charges", "add_deduct_tax", function(doc,
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(!d.category && d.add_deduct_tax) { if(!d.category && d.add_deduct_tax) {
msgprint(__("Please select Category first")); frappe.msgprint(__("Please select Category first"));
d.add_deduct_tax = ''; d.add_deduct_tax = '';
} }
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') { 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 = ''; d.add_deduct_tax = '';
} }
refresh_field('add_deduct_tax', d.name, 'taxes'); 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]; var d = locals[cdt][cdn];
if (d.category != 'Total' && d.add_deduct_tax == 'Deduct') { 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 = ''; d.add_deduct_tax = '';
} }
refresh_field('add_deduct_tax', d.name, 'taxes'); refresh_field('add_deduct_tax', d.name, 'taxes');

View File

@ -267,7 +267,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(this.frm.doc.is_pos) { if(this.frm.doc.is_pos) {
if(!this.frm.doc.company) { if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0); this.frm.set_value("is_pos", 0);
msgprint(__("Please specify Company to proceed")); frappe.msgprint(__("Please specify Company to proceed"));
} else { } else {
var me = this; var me = this;
return this.frm.call({ return this.frm.call({
@ -311,19 +311,19 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
// Hide Fields // Hide Fields
// ------------ // ------------
cur_frm.cscript.hide_fields = function(doc) { 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']; 'advances', 'sales_partner', 'commission_rate', 'total_commission', 'advances', 'from_date', 'to_date'];
if(cint(doc.is_pos) == 1) { if(cint(doc.is_pos) == 1) {
hide_field(parent_fields); hide_field(parent_fields);
} else { } else {
for (i in parent_fields) { for (var i in parent_fields) {
var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]]; var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
if(!docfield.hidden) unhide_field(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'] 'warehouse', 'expense_account', 'quality_inspection']
cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock, cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
(cint(doc.update_stock)==1 || cint(doc.is_return)==1 ? true : false)); (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 // 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) { cur_frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) {
return { return {
filters: { filters: {
@ -442,11 +442,12 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
}) })
if(cur_frm.doc.is_pos) { if(cur_frm.doc.is_pos) {
cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \ cur_frm.msgbox = frappe.msgprint(
onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\ `<a class="btn btn-primary" onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">
<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">{1}</a>', [ ${__('Print')}</a>
__('Print'), __('New') <a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">
])); ${__('New')}</a>`
);
} else if(cint(frappe.boot.notification_settings.sales_invoice)) { } else if(cint(frappe.boot.notification_settings.sales_invoice)) {
cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message); cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);

View File

@ -113,7 +113,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
email_prompt: function() { email_prompt: function() {
var me = this; 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", collapsible: 1, label: "CC & Standard Reply"},
{fieldtype: "Section Break"}, {fieldtype: "Section Break"},
{label:__("Subject"), fieldtype:"Data", reqd: 1, {label:__("Subject"), fieldtype:"Data", reqd: 1,
@ -602,7 +602,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
var html = ""; var html = "";
if(this.si_docs.length) { if(this.si_docs.length) {
this.si_docs.forEach(function (data, i) { this.si_docs.forEach(function (data, i) {
for (key in data) { for (var key in data) {
html += frappe.render_template("pos_invoice_list", { html += frappe.render_template("pos_invoice_list", {
sr: i + 1, sr: i + 1,
name: key, name: key,
@ -965,7 +965,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
make_item_list: function () { make_item_list: function () {
var me = this; var me = this;
if (!this.price_list) { if (!this.price_list) {
msgprint(__("Price List not found or disabled")); frappe.msgprint(__("Price List not found or disabled"));
return; return;
} }
@ -1232,7 +1232,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
remove_zero_qty_item: function () { remove_zero_qty_item: function () {
var me = this; var me = this;
idx = 0 var idx = 0;
this.items = [] this.items = []
$.each(this.frm.doc["items"] || [], function (i, d) { $.each(this.frm.doc["items"] || [], function (i, d) {
if (!in_list(me.remove_item, d.idx)) { 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 () { this.wrapper.find('input.discount-percentage').on("change", function () {
me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage")); 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') { if (me.frm.doc.apply_discount_on == 'Net Total') {
total = me.frm.doc.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) { if (this.frm.doc.docstatus == 1) {
this.page.set_secondary_action(__("Print"), function () { 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) me.print_document(html)
}) })
this.page.add_menu_item(__("Email"), function () { this.page.add_menu_item(__("Email"), function () {
@ -1465,19 +1465,18 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
print_dialog: function () { print_dialog: function () {
var me = this; var me = this;
this.msgprint = frappe.msgprint(format('<a class="btn btn-primary print_doc" \ this.frappe.msgprint = frappe.msgprint(
style="margin-right: 5px;">{0}</a>\ `<a class="btn btn-primary print_doc"
<a class="btn btn-default new_doc">{1}</a>', [ style="margin-right: 5px;">${__('Print')}</a>
__('Print'), __('New') <a class="btn btn-default new_doc">${__('New')}</a>`);
]));
$('.print_doc').click(function () { $('.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) me.print_document(html)
}) })
$('.new_doc').click(function () { $('.new_doc').click(function () {
me.msgprint.hide() me.frappe.msgprint.hide()
me.make_new_cart() me.make_new_cart()
}) })
}, },
@ -1506,9 +1505,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
//Remove the sold serial no from the cache //Remove the sold serial no from the cache
$.each(this.frm.doc.items, function(index, data) { $.each(this.frm.doc.items, function(index, data) {
sn = data.serial_no.split('\n') var sn = data.serial_no.split('\n')
if(sn.length) { 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) { if(serial_no_list) {
$.each(sn, function(i, serial_no) { $.each(sn, function(i, serial_no) {
if(in_list(Object.keys(serial_no_list), 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 () { toggle_input_field: function () {
var pointer_events = 'inherit' 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('input').attr("disabled", disabled);
$(this.wrapper).find('select').attr("disabled", disabled); $(this.wrapper).find('select').attr("disabled", disabled);
$(this.wrapper).find('input').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; var me = this;
this.si_docs = this.get_doc_from_localstorage(); this.si_docs = this.get_doc_from_localstorage();
$.each(this.si_docs, function (index, data) { $.each(this.si_docs, function (index, data) {
for (key in data) { for (var key in data) {
if (key == me.name) { if (key == me.name) {
me.si_docs[index][key] = me.frm.doc; me.si_docs[index][key] = me.frm.doc;
me.update_localstorage(); me.update_localstorage();
@ -1634,10 +1633,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
get_submitted_invoice: function () { get_submitted_invoice: function () {
var invoices = []; var invoices = [];
var index = 1; var index = 1;
docs = this.get_doc_from_localstorage(); var docs = this.get_doc_from_localstorage();
if (docs) { if (docs) {
invoices = $.map(docs, function (data) { invoices = $.map(docs, function (data) {
for (key in data) { for (var key in data) {
if (data[key].docstatus == 1 && index < 50) { if (data[key].docstatus == 1 && index < 50) {
index++ index++
data[key].docstatus = 0; data[key].docstatus = 0;
@ -1656,7 +1655,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.new_si_docs = []; this.new_si_docs = [];
if (this.removed_items) { if (this.removed_items) {
$.each(this.si_docs, function (index, data) { $.each(this.si_docs, function (index, data) {
for (key in data) { for (var key in data) {
if (!in_list(me.removed_items, key)) { if (!in_list(me.removed_items, key)) {
me.new_si_docs.push(data); me.new_si_docs.push(data);
} }
@ -1715,8 +1714,9 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
validate_serial_no: function () { validate_serial_no: function () {
var me = this; var me = this;
var item_code = serial_no = ''; var item_code = ''
for (key in this.item_serial_no) { var serial_no = '';
for (var key in this.item_serial_no) {
item_code = key; item_code = key;
serial_no = me.item_serial_no[key][0]; serial_no = me.item_serial_no[key][0];
} }
@ -1763,9 +1763,13 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
mandatory_batch_no: function () { mandatory_batch_no: function () {
var me = this; var me = this;
if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) { if (this.items[0].has_batch_no && !this.item_batch_no[this.items[0].item_code]) {
frappe.prompt([ frappe.prompt([{
{'fieldname': 'batch', 'fieldtype': 'Select', 'label': __('Batch No'), 'reqd': 1, 'options':this.batch_no_data[this.items[0].item_code]} 'fieldname': 'batch',
], 'fieldtype': 'Select',
'label': __('Batch No'),
'reqd': 1,
'options': this.batch_no_data[this.items[0].item_code]
}],
function(values){ function(values){
me.item_batch_no[me.items[0].item_code] = values.batch; me.item_batch_no[me.items[0].item_code] = values.batch;
}, },
@ -1776,7 +1780,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
apply_pricing_rule: function () { apply_pricing_rule: function () {
var me = this; var me = this;
$.each(this.frm.doc["items"], function (n, item) { $.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) me.validate_pricing_rule(pricing_rule)
if (pricing_rule.length) { if (pricing_rule.length) {
item.pricing_rule = pricing_rule[0].name; item.pricing_rule = pricing_rule[0].name;
@ -1836,7 +1840,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
validate_condition: function (data) { validate_condition: function (data) {
//This method check condition based on applicable for //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])) { if (in_list(condition[1], condition[0])) {
return true 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) { $.each(priority_list, function (index, value) {
if (value == priority) { if (value == priority) {
count++ count++

View File

@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable"] = {
"fieldname":"report_date", "fieldname":"report_date",
"label": __("As on Date"), "label": __("As on Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"ageing_based_on", "fieldname":"ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date' + NEWLINE + 'Due Date', "options": 'Posting Date\nDue Date',
"default": "Posting Date" "default": "Posting Date"
}, },
{ {

View File

@ -20,13 +20,13 @@ frappe.query_reports["Accounts Payable Summary"] = {
"fieldname":"report_date", "fieldname":"report_date",
"label": __("Date"), "label": __("Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"ageing_based_on", "fieldname":"ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date' + NEWLINE + 'Due Date', "options": 'Posting Date\nDue Date',
"default": "Posting Date" "default": "Posting Date"
}, },
{ {

View File

@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"credit_days_based_on", "fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"), "label": __("Credit Days Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month" "options": "\nFixed Days\nLast Day of the Next Month"
}, },
{ {
"fieldtype": "Break", "fieldtype": "Break",
@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname":"report_date", "fieldname":"report_date",
"label": __("As on Date"), "label": __("As on Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"ageing_based_on", "fieldname":"ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date' + NEWLINE + 'Due Date', "options": 'Posting Date\nDue Date',
"default": "Posting Date" "default": "Posting Date"
}, },
{ {

View File

@ -26,7 +26,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldname":"credit_days_based_on", "fieldname":"credit_days_based_on",
"label": __("Credit Days Based On"), "label": __("Credit Days Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": "" + NEWLINE + "Fixed Days" + NEWLINE + "Last Day of the Next Month" "options": "\nFixed Days\nLast Day of the Next Month"
}, },
{ {
"fieldtype": "Break", "fieldtype": "Break",
@ -35,13 +35,13 @@ frappe.query_reports["Accounts Receivable Summary"] = {
"fieldname":"report_date", "fieldname":"report_date",
"label": __("Date"), "label": __("Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"ageing_based_on", "fieldname":"ageing_based_on",
"label": __("Ageing Based On"), "label": __("Ageing Based On"),
"fieldtype": "Select", "fieldtype": "Select",
"options": 'Posting Date' + NEWLINE + 'Due Date', "options": 'Posting Date\nDue Date',
"default": "Posting Date" "default": "Posting Date"
}, },
{ {
@ -70,7 +70,7 @@ frappe.query_reports["Accounts Receivable Summary"] = {
onload: function(report) { onload: function(report) {
report.page.add_inner_button(__("Accounts Receivable"), function() { report.page.add_inner_button(__("Accounts Receivable"), function() {
var filters = report.get_values(); 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 });
}); });
} }
} }

View File

@ -14,7 +14,7 @@ frappe.query_reports["Bank Clearance Summary"] = {
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"account", "fieldname":"account",

View File

@ -25,7 +25,7 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
"fieldname":"report_date", "fieldname":"report_date",
"label": __("Date"), "label": __("Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today(), "default": frappe.datetime.get_today(),
"reqd": 1 "reqd": 1
}, },
] ]

View File

@ -8,7 +8,7 @@ frappe.query_reports["Budget Variance Report"] = {
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: sys_defaults.fiscal_year, default: frappe.sys_defaults.fiscal_year,
reqd: 1 reqd: 1
}, },
{ {

View File

@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Purchase Register"] = {
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname": "item_code", "fieldname": "item_code",

View File

@ -14,7 +14,7 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"customer", "fieldname":"customer",

View File

@ -21,7 +21,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
fieldname:"to_date", fieldname:"to_date",
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
default: get_today() default: frappe.datetime.get_today()
}, },
{ {
fieldname:"payment_type", fieldname:"payment_type",

View File

@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() { frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
frappe.query_reports["Purchase Invoice Trends"] = { frappe.query_reports["Purchase Invoice Trends"] = {
filters: get_filters() filters: erpnext.get_purchase_trends_filters()
} }
}); });

View File

@ -14,7 +14,7 @@ frappe.query_reports["Purchase Register"] = {
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"supplier", "fieldname":"supplier",

View File

@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() { frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.query_reports["Sales Invoice Trends"] = { frappe.query_reports["Sales Invoice Trends"] = {
filters: get_filters() filters: erpnext.get_sales_trends_filters()
} }
}); });

View File

@ -14,7 +14,7 @@ frappe.query_reports["Sales Register"] = {
"fieldname":"to_date", "fieldname":"to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today() "default": frappe.datetime.get_today()
}, },
{ {
"fieldname":"customer", "fieldname":"customer",

View File

@ -1,34 +1,34 @@
frappe.listview_settings['Purchase Order'] = { frappe.listview_settings['Purchase Order'] = {
add_fields: ["base_grand_total", "company", "currency", "supplier", add_fields: ["base_grand_total", "company", "currency", "supplier",
"supplier_name", "per_received", "per_billed", "status"], "supplier_name", "per_received", "per_billed", "status"],
get_indicator: function(doc) { get_indicator: function (doc) {
if(doc.status==="Closed"){ if (doc.status === "Closed") {
return [__("Closed"), "green", "status,=,Closed"]; return [__("Closed"), "green", "status,=,Closed"];
} else if (doc.status==="Delivered") { } else if (doc.status === "Delivered") {
return [__("Delivered"), "green", "status,=,Closed"]; return [__("Delivered"), "green", "status,=,Closed"];
}else if(flt(doc.per_received, 2) < 100 && doc.status!=="Closed") { } else if (flt(doc.per_received, 2) < 100 && doc.status !== "Closed") {
if(flt(doc.per_billed, 2) < 100) { if (flt(doc.per_billed, 2) < 100) {
return [__("To Receive and Bill"), "orange", return [__("To Receive and Bill"), "orange",
"per_received,<,100|per_billed,<,100|status,!=,Closed"]; "per_received,<,100|per_billed,<,100|status,!=,Closed"];
} else { } else {
return [__("To Receive"), "orange", return [__("To Receive"), "orange",
"per_received,<,100|per_billed,=,100|status,!=,Closed"]; "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"]; 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"]; 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"; var method = "erpnext.buying.doctype.purchase_order.purchase_order.close_or_unclose_purchase_orders";
listview.page.add_menu_item(__("Close"), function() { listview.page.add_menu_item(__("Close"), function () {
listview.call_for_selected_items(method, {"status": "Closed"}); listview.call_for_selected_items(method, { "status": "Closed" });
}); });
listview.page.add_menu_item(__("Re-open"), function() { listview.page.add_menu_item(__("Re-open"), function () {
listview.call_for_selected_items(method, {"status": "Submitted"}); listview.call_for_selected_items(method, { "status": "Submitted" });
}); });
} }
}; };

View File

@ -56,17 +56,17 @@ frappe.ui.form.on("Request for Quotation",{
var dialog = new frappe.ui.Dialog({ var dialog = new frappe.ui.Dialog({
title: __("For Supplier"), title: __("For Supplier"),
fields: [ fields: [
{"fieldtype": "Select", "label": __("Supplier"), { "fieldtype": "Select", "label": __("Supplier"),
"fieldname": "supplier", "options":"Supplier", "fieldname": "supplier",
"options": $.map(doc.suppliers, "options": doc.suppliers.map(d => d.supplier),
function(d) { return d.supplier }), "reqd": 1 }, "reqd": 1 },
{"fieldtype": "Button", "label": __("Make Supplier Quotation"), { "fieldtype": "Button", "label": __("Make Supplier Quotation"),
"fieldname": "make_supplier_quotation", "cssClass": "btn-primary"}, "fieldname": "make_supplier_quotation", "cssClass": "btn-primary" },
] ]
}); });
dialog.fields_dict.make_supplier_quotation.$input.click(function() { dialog.fields_dict.make_supplier_quotation.$input.click(function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
dialog.hide(); dialog.hide();
return frappe.call({ return frappe.call({
@ -117,7 +117,7 @@ frappe.ui.form.on("Request for Quotation Supplier",{
+"&supplier_idx="+encodeURIComponent(child.idx) +"&supplier_idx="+encodeURIComponent(child.idx)
+"&no_letterhead=0")); +"&no_letterhead=0"));
if(!w) { if(!w) {
msgprint(__("Please enable pop-ups")); return; frappe.msgprint(__("Please enable pop-ups")); return;
} }
} }
}) })

View File

@ -2,9 +2,9 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Supplier", { frappe.ui.form.on("Supplier", {
setup: function(frm) { setup: function (frm) {
frm.set_query('default_price_list', { 'buying': 1}); frm.set_query('default_price_list', { 'buying': 1 });
frm.set_query('account', 'accounts', function(doc, cdt, cdn) { frm.set_query('account', 'accounts', function (doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
return { return {
filters: { filters: {
@ -15,30 +15,30 @@ frappe.ui.form.on("Supplier", {
} }
}); });
}, },
refresh: function(frm) { refresh: function (frm) {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Supplier'} 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); frm.toggle_display("naming_series", false);
} else { } else {
erpnext.toggle_naming_series(); erpnext.toggle_naming_series();
} }
if(frm.doc.__islocal){ if (frm.doc.__islocal) {
hide_field(['address_html','contact_html']); hide_field(['address_html', 'contact_html']);
frappe.geo.clear_address_and_contact(frm); frappe.geo.clear_address_and_contact(frm);
} }
else { else {
unhide_field(['address_html','contact_html']); unhide_field(['address_html', 'contact_html']);
frappe.geo.render_address_and_contact(frm); frappe.geo.render_address_and_contact(frm);
// custom buttons // custom buttons
frm.add_custom_button(__('Accounting Ledger'), function() { frm.add_custom_button(__('Accounting Ledger'), function () {
frappe.set_route('query-report', 'General Ledger', 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() { frm.add_custom_button(__('Accounts Payable'), function () {
frappe.set_route('query-report', 'Accounts Payable', {supplier:frm.doc.name}); frappe.set_route('query-report', 'Accounts Payable', { supplier: frm.doc.name });
}); });
// indicators // indicators

View File

@ -5,7 +5,7 @@
{% include 'erpnext/public/js/controllers/buying.js' %}; {% include 'erpnext/public/js/controllers/buying.js' %};
frappe.ui.form.on('Suppier Quotation', { frappe.ui.form.on('Suppier Quotation', {
setup: function() { setup: function(frm) {
frm.custom_make_buttons = { frm.custom_make_buttons = {
'Purchase Order': 'Purchase Order' 'Purchase Order': 'Purchase Order'
} }

View File

@ -10,7 +10,6 @@ frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
new erpnext.PurchaseAnalytics(wrapper); new erpnext.PurchaseAnalytics(wrapper);
frappe.breadcrumbs.add("Buying"); frappe.breadcrumbs.add("Buying");
} }
@ -18,7 +17,6 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
init: function(wrapper) { init: function(wrapper) {
this._super({ this._super({
title: __("Purchase Analytics"), title: __("Purchase Analytics"),
page: wrapper,
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
page: wrapper.page, page: wrapper.page,
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year", doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
@ -193,13 +191,13 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
}, },
prepare_balances: function() { prepare_balances: function() {
var me = this; var me = this;
var from_date = dateutil.str_to_obj(this.from_date); var from_date = frappe.datetime.str_to_obj(this.from_date);
var to_date = dateutil.str_to_obj(this.to_date); var to_date = frappe.datetime.str_to_obj(this.to_date);
var is_val = this.value_or_qty == 'Value'; var is_val = this.value_or_qty == 'Value';
$.each(this.tl[this.based_on], function(i, tl) { $.each(this.tl[this.based_on], function(i, tl) {
if (me.is_default('company') ? true : tl.company === me.company) { 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) { if (posting_date >= from_date && posting_date <= to_date) {
var item = me.item_by_name[tl[me.tree_grid.item_key]] || var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
me.item_by_name['Not Set']; me.item_by_name['Not Set'];

View File

@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() { frappe.require("assets/erpnext/js/purchase_trends_filters.js", function() {
frappe.query_reports["Purchase Order Trends"] = { frappe.query_reports["Purchase Order Trends"] = {
filters: get_filters() filters: erpnext.get_purchase_trends_filters()
} }
}); });

View File

@ -4,29 +4,25 @@
frappe.query_reports["Quoted Item Comparison"] = { frappe.query_reports["Quoted Item Comparison"] = {
"filters": [ "filters": [
{ {
"fieldname":"supplier_quotation", "fieldname": "supplier_quotation",
"label": __("Supplier Quotation"), "label": __("Supplier Quotation"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Supplier Quotation", "options": "Supplier Quotation",
"default": "", "default": "",
"get_query": function() { "get_query": function () {
return { return { filters: { "docstatus": ["<", 2] } }
filters: {"docstatus": ["<",2]}
} }
} },
{
"fieldname": "item",
},{
"fieldname":"item",
"label": __("Item"), "label": __("Item"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Item", "options": "Item",
"default": "", "default": "",
"reqd": 1, "reqd": 1,
"get_query": function() { "get_query": function () {
var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value(); var quote = frappe.query_report_filters_by_name.supplier_quotation.get_value();
if (quote != "") if (quote != "") {
{
return { return {
query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query", query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query",
filters: { filters: {
@ -35,57 +31,56 @@ frappe.query_reports["Quoted Item Comparison"] = {
} }
} }
} }
else{ else {
return{ return {
filters: {"disabled":0} filters: { "disabled": 0 }
} }
} }
} }
} }
], ],
onload: function(report) { onload: function (report) {
//Create a button for setting the default supplier // Create a button for setting the default supplier
report.page.add_inner_button(__("Select Default Supplier"), function() { report.page.add_inner_button(__("Select Default Supplier"), function () {
var reporter = frappe.query_reports["Quoted Item Comparison"]; var reporter = frappe.query_reports["Quoted Item Comparison"];
//Always make a new one so that the latest values get updated //Always make a new one so that the latest values get updated
reporter.make_default_supplier_dialog(report); reporter.make_default_supplier_dialog(report);
report.dialog.show(); report.dialog.show();
setTimeout(function() { report.dialog.input.focus(); }, 1000); setTimeout(function () { report.dialog.input.focus(); }, 1000);
}, 'Tools'); }, 'Tools');
}, },
"make_default_supplier_dialog": function (report) { "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 filters = report.get_values();
var item_code = filters.item; 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 = ""; var select_options = "";
for (let supplier of report.data) for (let supplier of report.data) {
{ select_options += supplier.supplier_name + '\n'
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({ var d = new frappe.ui.Dialog({
title: __('Select Default Supplier'), title: __('Select Default Supplier'),
fields: [ fields: [
{fieldname: 'supplier', fieldtype:'Select', label:'Supplier', reqd:1,options:select_options}, { fieldname: 'supplier', fieldtype: 'Select', label: 'Supplier', reqd: 1, options: select_options },
{fieldname: 'ok_button', fieldtype:'Button', label:'Set Default Supplier'}, { fieldname: 'ok_button', fieldtype: 'Button', label: 'Set Default Supplier' },
] ]
}); });
//On the user clicking the ok button // On the user clicking the ok button
d.fields_dict.ok_button.input.onclick = function() { d.fields_dict.ok_button.input.onclick = function () {
var btn = d.fields_dict.ok_button.input; var btn = d.fields_dict.ok_button.input;
var v = report.dialog.get_values(); var v = report.dialog.get_values();
if(v) { if (v) {
$(btn).set_working(); $(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({ frappe.call({
method: "frappe.client.set_value", method: "frappe.client.set_value",
args: { args: {
@ -94,20 +89,16 @@ frappe.query_reports["Quoted Item Comparison"] = {
fieldname: "default_supplier", fieldname: "default_supplier",
value: v.supplier, value: v.supplier,
}, },
callback: function (r){ callback: function (r) {
$(btn).done_working(); $(btn).done_working();
msgprint("Successfully Set Supplier"); frappe.msgprint("Successfully Set Supplier");
report.dialog.hide(); report.dialog.hide();
} }
}); });
} }
} }
report.dialog = d; report.dialog = d;
} }
} }

View File

@ -13,28 +13,29 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) { if(cur_frm.fields_dict.lead_owner.df.options.match(/^User/)) {
cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) { 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/)) { if(cur_frm.fields_dict.contact_by.df.options.match(/^User/)) {
cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) { 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() { refresh: function() {
var doc = this.frm.doc; var doc = this.frm.doc;
erpnext.toggle_naming_series(); 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(__("Customer"), this.create_customer, __("Make"));
this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make")); this.frm.add_custom_button(__("Opportunity"), this.create_opportunity, __("Make"));
this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Make")); this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Make"));
cur_frm.page.set_inner_btn_group_as_primary(__("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); frappe.geo.render_address_and_contact(cur_frm);
} else { } else {
frappe.geo.clear_address_and_contact(cur_frm); frappe.geo.clear_address_and_contact(cur_frm);

View File

@ -107,7 +107,8 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
$.each([["lead", "lead"], $.each([["lead", "lead"],
["customer", "customer"], ["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]]); me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
}); });
}, },
@ -184,7 +185,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
}); });
dialog.fields_dict.update.$input.click(function() { dialog.fields_dict.update.$input.click(function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
return cur_frm.call({ return cur_frm.call({
doc: cur_frm.doc, doc: cur_frm.doc,
@ -192,7 +193,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
args: args.reason, args: args.reason,
callback: function(r) { callback: function(r) {
if(r.exc) { if(r.exc) {
msgprint(__("There were errors.")); frappe.msgprint(__("There were errors."));
} else { } else {
dialog.hide(); dialog.hide();
cur_frm.refresh(); cur_frm.refresh();

View File

@ -15,5 +15,5 @@ frappe.query_reports["Campaign Efficiency"] = {
"default": frappe.defaults.get_user_default("year_end_date"), "default": frappe.defaults.get_user_default("year_end_date"),
} }
] ]
}; };

View File

@ -4,27 +4,27 @@
frappe.query_reports["Minutes to First Response for Opportunity"] = { frappe.query_reports["Minutes to First Response for Opportunity"] = {
"filters": [ "filters": [
{ {
"fieldname":"from_date", "fieldname": "from_date",
"label": __("From Date"), "label": __("From Date"),
"fieldtype": "Date", "fieldtype": "Date",
'reqd': 1, 'reqd': 1,
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30) "default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
}, },
{ {
"fieldname":"to_date", "fieldname": "to_date",
"label": __("To Date"), "label": __("To Date"),
"fieldtype": "Date", "fieldtype": "Date",
'reqd': 1, 'reqd': 1,
"default":frappe.datetime.nowdate() "default": frappe.datetime.nowdate()
}, },
], ],
get_chart_data: function(columns, result) { get_chart_data: function (columns, result) {
return { return {
data: { data: {
x: 'Date', x: 'Date',
columns: [ columns: [
['Date'].concat($.map(result, function(d) { return d[0]; })), ['Date'].concat($.map(result, function (d) { return d[0]; })),
['Mins to first response'].concat($.map(result, function(d) { return d[1]; })) ['Mins to first response'].concat($.map(result, function (d) { return d[1]; }))
] ]
// rows: [['Date', 'Mins to first response']].concat(result) // rows: [['Date', 'Mins to first response']].concat(result)
}, },

View File

@ -46,11 +46,11 @@ cur_frm.cscript.score = function(doc,cdt,cdn){
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if (d.score){ if (d.score){
if (flt(d.score) > 5) { 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; d.score = 0;
refresh_field('score', d.name, 'goals'); 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); d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'goals'); refresh_field('score_earned', d.name, 'goals');
} }

View File

@ -5,7 +5,7 @@ cur_frm.add_fetch('employee', 'company', 'company');
cur_frm.add_fetch('employee', 'employee_name', 'employee_name'); cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
cur_frm.cscript.onload = function(doc, cdt, cdn) { 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) { cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {

View File

@ -5,7 +5,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
onload: function(frm) { onload: function(frm) {
frm.doc.department = frm.doc.branch = frm.doc.company = "All"; 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); erpnext.employee_attendance_tool.load_employees(frm);
}, },

View File

@ -2,8 +2,8 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Employee Loan', { frappe.ui.form.on('Employee Loan', {
onload: function(frm) { onload: function (frm) {
frm.set_query("employee_loan_application", function() { frm.set_query("employee_loan_application", function () {
return { return {
"filters": { "filters": {
"employee": frm.doc.employee, "employee": frm.doc.employee,
@ -13,7 +13,7 @@ frappe.ui.form.on('Employee Loan', {
}; };
}); });
frm.set_query("interest_income_account", function() { frm.set_query("interest_income_account", function () {
return { return {
"filters": { "filters": {
"company": frm.doc.company, "company": frm.doc.company,
@ -23,8 +23,8 @@ frappe.ui.form.on('Employee Loan', {
}; };
}); });
$.each(["payment_account", "employee_loan_account"], function(i, field) { $.each(["payment_account", "employee_loan_account"], function (i, field) {
frm.set_query(field, function() { frm.set_query(field, function () {
return { return {
"filters": { "filters": {
"company": frm.doc.company, "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")) { 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("make_jv");
}) })
} }
frm.trigger("toggle_fields"); frm.trigger("toggle_fields");
}, },
make_jv: function(frm) { make_jv: function (frm) {
frappe.call({ frappe.call({
args: { args: {
"employee_loan": frm.doc.name, "employee_loan": frm.doc.name,
@ -56,36 +56,36 @@ frappe.ui.form.on('Employee Loan', {
"payment_account": frm.doc.payment_account "payment_account": frm.doc.payment_account
}, },
method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry", method: "erpnext.hr.doctype.employee_loan.employee_loan.make_jv_entry",
callback: function(r) { callback: function (r) {
if (r.message) if (r.message)
var doc = frappe.model.sync(r.message)[0]; 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({ frappe.call({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
args: { args: {
"mode_of_payment": frm.doc.mode_of_payment, "mode_of_payment": frm.doc.mode_of_payment,
"company": frm.doc.company "company": frm.doc.company
}, },
callback: function(r, rt) { callback: function (r, rt) {
if(r.message) { if (r.message) {
frm.set_value("payment_account", r.message.account); frm.set_value("payment_account", r.message.account);
} }
} }
}); });
}, },
employee_loan_application: function(frm) { employee_loan_application: function (frm) {
return frappe.call({ return frappe.call({
method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application", method: "erpnext.hr.doctype.employee_loan.employee_loan.get_employee_loan_application",
args: { args: {
"employee_loan_application": frm.doc.employee_loan_application "employee_loan_application": frm.doc.employee_loan_application
}, },
callback: function(r){ callback: function (r) {
if(!r.exc && r.message) { if (!r.exc && r.message) {
frm.set_value("loan_type", r.message.loan_type); frm.set_value("loan_type", r.message.loan_type);
frm.set_value("loan_amount", r.message.loan_amount); frm.set_value("loan_amount", r.message.loan_amount);
frm.set_value("repayment_method", r.message.repayment_method); 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") frm.trigger("toggle_fields")
}, },
toggle_fields: function(frm) { toggle_fields: function (frm) {
frm.toggle_enable("monthly_repayment_amount", frm.doc.repayment_method=="Repay Fixed Amount per Period") 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") frm.toggle_enable("repayment_periods", frm.doc.repayment_method == "Repay Over Number of Periods")
} }
}); });

View File

@ -52,7 +52,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
cur_frm.set_value("approval_status", "Draft") cur_frm.set_value("approval_status", "Draft")
if (doc.__islocal) { 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) if(doc.amended_from)
cur_frm.set_value("approval_status", "Draft"); cur_frm.set_value("approval_status", "Draft");
cur_frm.cscript.clear_sanctioned(doc); cur_frm.cscript.clear_sanctioned(doc);
@ -81,14 +81,14 @@ cur_frm.cscript.clear_sanctioned = function(doc) {
refresh_many(['sanctioned_amount', 'total_sanctioned_amount']); 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); cur_frm.cscript.set_help(doc);
if(!doc.__islocal) { if(!doc.__islocal) {
cur_frm.toggle_enable("exp_approver", doc.approval_status=="Draft"); 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") if (doc.docstatus==0 && doc.exp_approver==frappe.session.user && doc.approval_status=="Approved")
cur_frm.savesubmit(); cur_frm.savesubmit();
if (doc.docstatus===1 && doc.approval_status=="Approved") { if (doc.docstatus===1 && doc.approval_status=="Approved") {
@ -97,6 +97,8 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
cur_frm.page.set_inner_btn_group_as_primary(__("Make")); 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")) { if (cint(doc.total_amount_reimbursed) > 0 && frappe.model.can_read("Journal Entry")) {
cur_frm.add_custom_button(__('Bank Entries'), function() { cur_frm.add_custom_button(__('Bank Entries'), function() {
frappe.route_options = { frappe.route_options = {
@ -107,17 +109,18 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
frappe.set_route("List", "Journal Entry"); frappe.set_route("List", "Journal Entry");
}, __("View")); }, __("View"));
} }
/* eslint-enable */
} }
} }
} }
cur_frm.cscript.set_help = function(doc) { cur_frm.cscript.set_help = function(doc) {
cur_frm.set_intro(""); 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")) cur_frm.set_intro(__("Fill the form and save it"))
} else { } else {
if(doc.docstatus==0 && doc.approval_status=="Draft") { 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")); cur_frm.set_intro(__("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
} else { } else {
cur_frm.set_intro(__("Expense Claim is pending approval. Only the Expense Approver can update status.")); cur_frm.set_intro(__("Expense Claim is pending approval. Only the Expense Approver can update status."));

View File

@ -5,7 +5,7 @@ cur_frm.add_fetch('employee','employee_name','employee_name');
frappe.ui.form.on("Leave Allocation", { frappe.ui.form.on("Leave Allocation", {
onload: function(frm) { 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() { frm.set_query("employee", function() {
return { return {

View File

@ -7,7 +7,7 @@ cur_frm.add_fetch('employee','company','company');
frappe.ui.form.on("Leave Application", { frappe.ui.form.on("Leave Application", {
onload: function(frm) { onload: function(frm) {
if (!frm.doc.posting_date) { 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() { frm.set_query("leave_approver", function() {

View File

@ -1,19 +1,19 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
cur_frm.cscript.onload = function(doc, dt, dn){ cur_frm.cscript.onload = function (doc, dt, dn) {
if(!doc.posting_date) if (!doc.posting_date)
set_multiple(dt, dn, {posting_date: get_today()}); set_multiple(dt, dn, { posting_date: frappe.datetime.get_today() });
if(!doc.leave_transaction_type) if (!doc.leave_transaction_type)
set_multiple(dt, dn, {leave_transaction_type: 'Allocation'}); set_multiple(dt, dn, { leave_transaction_type: 'Allocation' });
} }
cur_frm.cscript.to_date = function(doc, cdt, cdn) { cur_frm.cscript.to_date = function (doc, cdt, cdn) {
return $c('runserverobj', args={'method':'to_date_validation','docs':doc}, return $c('runserverobj', { 'method': 'to_date_validation', 'docs': doc },
function(r, rt) { function (r, rt) {
var doc = locals[cdt][cdn]; var doc = locals[cdt][cdn];
if (r.message) { if (r.message) {
msgprint(__("To date cannot be before from date")); frappe.msgprint(__("To date cannot be before from date"));
doc.to_date = ''; doc.to_date = '';
refresh_field('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 = ''; doc.no_of_days = '';
refresh_field('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(); frm.disable_save();
}); });

View File

@ -4,18 +4,18 @@
frappe.provide("erpnext.offer_letter"); frappe.provide("erpnext.offer_letter");
frappe.ui.form.on("Offer Letter", { frappe.ui.form.on("Offer Letter", {
select_terms: function(frm) { select_terms: function (frm) {
erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function(r) { erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function (r) {
if(!r.exc) { if (!r.exc) {
me.frm.set_value("terms", r.message); frm.set_value("terms", r.message);
} }
}); });
}, },
refresh:function(frm){ refresh: function (frm) {
if((!frm.doc.__islocal) && (frm.doc.status=='Accepted') && (frm.doc.docstatus===1)){ if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted') && (frm.doc.docstatus === 1)) {
frm.add_custom_button(__('Make Employee'), frm.add_custom_button(__('Make Employee'),
function() { function () {
erpnext.offer_letter.make_employee(frm) 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({ frappe.model.open_mapped_doc({
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee", method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
frm: frm frm: frm

View File

@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Process Payroll", { frappe.ui.form.on("Process Payroll", {
onload: function(frm) { onload: function (frm) {
frm.doc.posting_date = frappe.datetime.nowdate(); frm.doc.posting_date = frappe.datetime.nowdate();
frm.doc.start_date = ''; frm.doc.start_date = '';
frm.doc.end_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); frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
}, },
setup: function(frm) { setup: function (frm) {
frm.set_query("payment_account", function() { frm.set_query("payment_account", function () {
var account_types = ["Bank", "Cash"]; var account_types = ["Bank", "Cash"];
return { return {
filters: { filters: {
@ -21,7 +21,7 @@ frappe.ui.form.on("Process Payroll", {
} }
} }
}), }),
frm.set_query("cost_center", function() { frm.set_query("cost_center", function () {
return { return {
filters: { filters: {
"is_group": 0, "is_group": 0,
@ -29,7 +29,7 @@ frappe.ui.form.on("Process Payroll", {
} }
} }
}), }),
frm.set_query("project", function() { frm.set_query("project", function () {
return { return {
filters: { filters: {
company: frm.doc.company company: frm.doc.company
@ -38,40 +38,40 @@ frappe.ui.form.on("Process Payroll", {
}) })
}, },
refresh: function(frm) { refresh: function (frm) {
frm.disable_save(); frm.disable_save();
}, },
payroll_frequency: function(frm) { payroll_frequency: function (frm) {
frm.trigger("set_start_end_dates"); frm.trigger("set_start_end_dates");
}, },
start_date: function(frm) { start_date: function (frm) {
frm.trigger("set_start_end_dates"); frm.trigger("set_start_end_dates");
}, },
end_date: function(frm) { end_date: function (frm) {
frm.trigger("set_start_end_dates"); 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); frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
}, },
payment_account: function(frm) { payment_account: function (frm) {
frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account!="" && frm.doc.payment_account!="undefined")); frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account != "" && frm.doc.payment_account != "undefined"));
}, },
set_start_end_dates: function(frm) { set_start_end_dates: function (frm) {
if (!frm.doc.salary_slip_based_on_timesheet){ if (!frm.doc.salary_slip_based_on_timesheet) {
frappe.call({ frappe.call({
method:'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates', method: 'erpnext.hr.doctype.process_payroll.process_payroll.get_start_end_dates',
args:{ args: {
payroll_frequency: frm.doc.payroll_frequency, payroll_frequency: frm.doc.payroll_frequency,
start_date: frm.doc.start_date || frm.doc.posting_date start_date: frm.doc.start_date || frm.doc.posting_date
}, },
callback: function(r){ callback: function (r) {
if (r.message){ if (r.message) {
frm.set_value('start_date', r.message.start_date); frm.set_value('start_date', r.message.start_date);
frm.set_value('end_date', r.message.end_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) { cur_frm.cscript.display_activity_log = function (msg) {
if(!cur_frm.ss_html) if (!cur_frm.ss_html)
cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div'); cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper, 'div');
if(msg) { if (msg) {
cur_frm.ss_html.innerHTML = cur_frm.ss_html.innerHTML =
'<div class="padding"><h4>'+__("Activity Log:")+'</h4>'+msg+'</div>'; '<div class="padding"><h4>' + __("Activity Log:") + '</h4>' + msg + '</div>';
} else { } else {
cur_frm.ss_html.innerHTML = ""; cur_frm.ss_html.innerHTML = "";
} }
} }
//Create salary slip // Create salary slip
//----------------------- // -----------------------
cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) { cur_frm.cscript.create_salary_slip = function (doc, cdt, cdn) {
cur_frm.cscript.display_activity_log(""); cur_frm.cscript.display_activity_log("");
var callback = function(r, rt){ var callback = function (r, rt) {
if (r.message) if (r.message)
cur_frm.cscript.display_activity_log(r.message); cur_frm.cscript.display_activity_log(r.message);
} }
return $c('runserverobj', args={'method':'create_salary_slips','docs':doc},callback); return $c('runserverobj', { 'method': 'create_salary_slips', 'docs': doc }, callback);
} }
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) { cur_frm.cscript.submit_salary_slip = function (doc, cdt, cdn) {
cur_frm.cscript.display_activity_log(""); cur_frm.cscript.display_activity_log("");
frappe.confirm(__("Do you really want to Submit all Salary Slip from {0} to {1}", [doc.start_date, doc.end_date]), function() { frappe.confirm(__("Do you really want to Submit all Salary Slip from {0} to {1}", [doc.start_date, doc.end_date]), function () {
// clear all in locals // clear all in locals
if(locals["Salary Slip"]) { if (locals["Salary Slip"]) {
$.each(locals["Salary Slip"], function(name, d) { $.each(locals["Salary Slip"], function (name, d) {
frappe.model.remove_from_locals("Salary Slip", name); frappe.model.remove_from_locals("Salary Slip", name);
}); });
} }
var callback = function(r, rt){ var callback = function (r, rt) {
if (r.message) if (r.message)
cur_frm.cscript.display_activity_log(r.message); cur_frm.cscript.display_activity_log(r.message);
} }
return $c('runserverobj', args={'method':'submit_salary_slips','docs':doc},callback); return $c('runserverobj', { 'method': 'submit_salary_slips', 'docs': doc }, callback);
}); });
} }
cur_frm.cscript.make_bank_entry = function(doc, cdt, cdn){ cur_frm.cscript.make_bank_entry = function (doc, cdt, cdn) {
if(doc.company && doc.start_date && doc.end_date){ if (doc.company && doc.start_date && doc.end_date) {
return frappe.call({ return frappe.call({
doc: cur_frm.doc, doc: cur_frm.doc,
method: "make_payment_entry", method: "make_payment_entry",
callback: function(r) { callback: function (r) {
if (r.message) if (r.message)
var doc = frappe.model.sync(r.message)[0]; var doc = frappe.model.sync(r.message)[0];
frappe.set_route("Form", doc.doctype, doc.name); frappe.set_route("Form", doc.doctype, doc.name);
} }
}); });
} else { } else {
msgprint(__("Company, From Date and To Date is mandatory")); frappe.msgprint(__("Company, From Date and To Date is mandatory"));
} }
} }

View File

@ -39,7 +39,7 @@ frappe.ui.form.on("Salary Slip", {
refresh: function(frm) { refresh: function(frm) {
frm.trigger("toggle_fields") frm.trigger("toggle_fields")
frm.trigger("toggle_reqd_fields") frm.trigger("toggle_reqd_fields")
salary_detail_fields = ['formula', 'abbr', 'statistical_component'] var salary_detail_fields = ['formula', 'abbr', 'statistical_component']
cur_frm.fields_dict['earnings'].grid.set_column_disp(salary_detail_fields,false); cur_frm.fields_dict['earnings'].grid.set_column_disp(salary_detail_fields,false);
cur_frm.fields_dict['deductions'].grid.set_column_disp(salary_detail_fields,false); cur_frm.fields_dict['deductions'].grid.set_column_disp(salary_detail_fields,false);
}, },

View File

@ -7,8 +7,8 @@ cur_frm.add_fetch('company', 'default_letter_head', 'letter_head');
cur_frm.cscript.onload = function(doc, dt, dn){ cur_frm.cscript.onload = function(doc, dt, dn){
e_tbl = doc.earnings || []; var e_tbl = doc.earnings || [];
d_tbl = doc.deductions || []; var d_tbl = doc.deductions || [];
if (e_tbl.length == 0 && d_tbl.length == 0) if (e_tbl.length == 0 && d_tbl.length == 0)
return function(r, rt) { refresh_many(['earnings', 'deductions']);}; return function(r, rt) { refresh_many(['earnings', 'deductions']);};
} }
@ -113,15 +113,18 @@ frappe.ui.form.on('Salary Structure', {
var d = new frappe.ui.Dialog({ var d = new frappe.ui.Dialog({
title: __("Preview Salary Slip"), title: __("Preview Salary Slip"),
fields: [ fields: [
{"fieldname":"employee", "fieldtype":"Select", "label":__("Employee"), { "fieldname":"employee", "fieldtype":"Select", "label":__("Employee"),
options: $.map(frm.doc.employees, function(d) { return d.employee }), reqd: 1, label:"Employee"}, options: $.map(frm.doc.employees, function(d) { return d.employee }), reqd: 1 },
{fieldname:"fetch", "label":__("Show Salary Slip"), "fieldtype":"Button"} { fieldname:"fetch", "label":__("Show Salary Slip"), "fieldtype":"Button"}
] ]
}); });
d.get_input("fetch").on("click", function() { d.get_input("fetch").on("click", function() {
var values = d.get_values(); var values = d.get_values();
if(!values) return; if(!values) return;
frm.doc.salary_slip_based_on_timesheet?print_format="Salary Slip based on Timesheet":print_format="Salary Slip Standard"; var print_format;
frm.doc.salary_slip_based_on_timesheet ?
print_format="Salary Slip based on Timesheet" :
print_format="Salary Slip Standard";
frappe.call({ frappe.call({
method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip", method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",

View File

@ -7,8 +7,8 @@ frappe.provide("erpnext.hr");
erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
this.frm.set_value("att_fr_date", get_today()); this.frm.set_value("att_fr_date", frappe.datetime.get_today());
this.frm.set_value("att_to_date", get_today()); this.frm.set_value("att_to_date", frappe.datetime.get_today());
}, },
refresh: function() { refresh: function() {
@ -18,7 +18,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
get_template:function() { get_template:function() {
if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) { if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) {
msgprint(__("Attendance From Date and Attendance To Date is mandatory")); frappe.msgprint(__("Attendance From Date and Attendance To Date is mandatory"));
return; return;
} }
window.location.href = repl(frappe.request.url + window.location.href = repl(frappe.request.url +

View File

@ -3,7 +3,7 @@
frappe.ui.form.on("Vehicle Log", { frappe.ui.form.on("Vehicle Log", {
refresh: function(frm,cdt,cdn) { refresh: function(frm,cdt,cdn) {
vehicle_log=frappe.model.get_doc(cdt,cdn); var vehicle_log=frappe.model.get_doc(cdt,cdn);
if (vehicle_log.license_plate) { if (vehicle_log.license_plate) {
frappe.call({ frappe.call({
method: "erpnext.hr.doctype.vehicle_log.vehicle_log.get_make_model", method: "erpnext.hr.doctype.vehicle_log.vehicle_log.get_make_model",
@ -35,7 +35,7 @@ frappe.ui.form.on("Vehicle Log", {
var doc = frappe.model.sync(r.message); var doc = frappe.model.sync(r.message);
frappe.set_route('Form', 'Expense Claim', r.message.name); frappe.set_route('Form', 'Expense Claim', r.message.name);
} }
}) });
} }
}); });

View File

@ -54,17 +54,18 @@ frappe.team_updates = {
data.avatar = frappe.avatar(data.sender); data.avatar = frappe.avatar(data.sender);
data.when = comment_when(data.creation); data.when = comment_when(data.creation);
var date = dateutil.str_to_obj(data.creation); var date = frappe.datetime.str_to_obj(data.creation);
var last = me.last_feed_date; var last = me.last_feed_date;
if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) { if((last && frappe.datetime.obj_to_str(last) != frappe.datetime.obj_to_str(date)) || (!last)) {
var diff = dateutil.get_day_diff(dateutil.get_today(), dateutil.obj_to_str(date)); var diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(), frappe.datetime.obj_to_str(date));
var pdate;
if(diff < 1) { if(diff < 1) {
pdate = 'Today'; pdate = 'Today';
} else if(diff < 2) { } else if(diff < 2) {
pdate = 'Yesterday'; pdate = 'Yesterday';
} else { } else {
pdate = dateutil.global_date_format(date); pdate = frappe.datetime.global_date_format(date);
} }
data.date_sep = pdate; data.date_sep = pdate;
data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator"; data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator";

View File

@ -7,7 +7,7 @@ frappe.query_reports["Salary Register"] = {
"fieldname":"date_range", "fieldname":"date_range",
"label": __("Date Range"), "label": __("Date Range"),
"fieldtype": "DateRange", "fieldtype": "DateRange",
"default": [frappe.datetime.add_months(get_today(),-1), frappe.datetime.get_today()], "default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
"reqd": 1 "reqd": 1
}, },
{ {

View File

@ -71,7 +71,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
if (item.start_date && item.end_date && item.periodicity) { if (item.start_date && item.end_date && item.periodicity) {
if(item.start_date > item.end_date) { if(item.start_date > item.end_date) {
msgprint(__("Row {0}:Start Date must be before End Date", [item.idx])); frappe.msgprint(__("Row {0}:Start Date must be before End Date", [item.idx]));
return; return;
} }
@ -97,7 +97,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.__islocal){ if(doc.__islocal){
set_multiple(dt,dn,{transaction_date:get_today()}); set_multiple(dt,dn,{transaction_date: frappe.datetime.get_today()});
} }
// set add fetch for item_code's item_name and description // set add fetch for item_code's item_name and description
@ -108,12 +108,12 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) { cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
if (!doc.__islocal) { if (!doc.__islocal) {
return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc}, return $c('runserverobj', {'method':'generate_schedule', 'docs':doc},
function(r, rt) { function(r, rt) {
refresh_field('schedules'); refresh_field('schedules');
}); });
} else { } else {
msgprint(__("Please save the document before generating maintenance schedule")); frappe.msgprint(__("Please save the document before generating maintenance schedule"));
} }
} }

View File

@ -2,8 +2,6 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.maintenance"); frappe.provide("erpnext.maintenance");
me.frm.set_query('contact_person', erpnext.queries.contact_query);
frappe.ui.form.on('Maintenance Visit', { frappe.ui.form.on('Maintenance Visit', {
setup: function(frm) { setup: function(frm) {
@ -85,7 +83,7 @@ $.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm
cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()}); if(doc.__islocal) set_multiple(dt,dn,{mntc_date: frappe.datetime.get_today()});
// set add fetch for item_code's item_name and description // set add fetch for item_code's item_name and description
cur_frm.add_fetch('item_code', 'item_name', 'item_name'); cur_frm.add_fetch('item_code', 'item_name', 'item_name');

View File

@ -63,7 +63,7 @@ erpnext.bom.BomController = erpnext.TransactionController.extend({
item_code: function(doc, cdt, cdn){ item_code: function(doc, cdt, cdn){
var scrap_items = false; var scrap_items = false;
child = locals[cdt][cdn]; var child = locals[cdt][cdn];
if(child.doctype == 'BOM Scrap Item') { if(child.doctype == 'BOM Scrap Item') {
scrap_items = true; scrap_items = true;
} }
@ -132,12 +132,12 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
var scrap_items = false; var scrap_items = false;
if(child.doctype == 'BOM Scrap Item') { if(cdt == 'BOM Scrap Item') {
scrap_items = true; scrap_items = true;
} }
if (d.bom_no) { if (d.bom_no) {
msgprint(__("You can not change rate if BOM mentioned agianst any item")); frappe.msgprint(__("You can not change rate if BOM mentioned agianst any item"));
get_bom_material_detail(doc, cdt, cdn, scrap_items); get_bom_material_detail(doc, cdt, cdn, scrap_items);
} else { } else {
erpnext.bom.calculate_rm_cost(doc); erpnext.bom.calculate_rm_cost(doc);
@ -159,8 +159,8 @@ erpnext.bom.calculate_op_cost = function(doc) {
doc.base_operating_cost = 0.0; doc.base_operating_cost = 0.0;
for(var i=0;i<op.length;i++) { for(var i=0;i<op.length;i++) {
operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2); var operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2); var base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2);
frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost); frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost);
frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost); frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost);
@ -173,11 +173,11 @@ erpnext.bom.calculate_op_cost = function(doc) {
// rm : raw material // rm : raw material
erpnext.bom.calculate_rm_cost = function(doc) { erpnext.bom.calculate_rm_cost = function(doc) {
var rm = doc.items || []; var rm = doc.items || [];
total_rm_cost = 0; var total_rm_cost = 0;
base_total_rm_cost = 0; var base_total_rm_cost = 0;
for(var i=0;i<rm.length;i++) { for(var i=0;i<rm.length;i++) {
amount = flt(rm[i].rate) * flt(rm[i].qty); var amount = flt(rm[i].rate) * flt(rm[i].qty);
base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty); var base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty);
frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate)) frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate))
frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount) frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount)
frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity)) frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity))
@ -192,13 +192,13 @@ erpnext.bom.calculate_rm_cost = function(doc) {
//sm : scrap material //sm : scrap material
erpnext.bom.calculate_scrap_materials_cost = function(doc) { erpnext.bom.calculate_scrap_materials_cost = function(doc) {
var sm = doc.scrap_items || []; var sm = doc.scrap_items || [];
total_sm_cost = 0; var total_sm_cost = 0;
base_total_sm_cost = 0; var base_total_sm_cost = 0;
for(var i=0;i<sm.length;i++) { for(var i=0;i<sm.length;i++) {
base_rate = flt(sm[i].rate) * flt(doc.conversion_rate); var base_rate = flt(sm[i].rate) * flt(doc.conversion_rate);
amount = flt(sm[i].rate) * flt(sm[i].qty); var amount = flt(sm[i].rate) * flt(sm[i].qty);
base_amount = flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate); var base_amount = flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate);
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate); frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate);
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount); frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount);
frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount); frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount);
@ -213,8 +213,8 @@ erpnext.bom.calculate_scrap_materials_cost = function(doc) {
// Calculate Total Cost // Calculate Total Cost
erpnext.bom.calculate_total = function(doc) { erpnext.bom.calculate_total = function(doc) {
total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost); var total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost);
base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost); var base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost);
cur_frm.set_value("total_cost", total_cost); cur_frm.set_value("total_cost", total_cost);
cur_frm.set_value("base_total_cost", base_total_cost); cur_frm.set_value("base_total_cost", base_total_cost);
} }

View File

@ -65,7 +65,7 @@ frappe.ui.form.on("Production Order", {
'width': (frm.doc.produced_qty / frm.doc.qty * 100) + '%', 'width': (frm.doc.produced_qty / frm.doc.qty * 100) + '%',
'progress_class': 'progress-bar-success' 'progress_class': 'progress-bar-success'
}); });
if(bars[0].width=='0%') { if (bars[0].width == '0%') {
bars[0].width = '0.5%'; bars[0].width = '0.5%';
added_min = 0.5; added_min = 0.5;
} }
@ -161,7 +161,7 @@ erpnext.production_order = {
var op = doc.operations; var op = doc.operations;
doc.planned_operating_cost = 0.0; doc.planned_operating_cost = 0.0;
for(var i=0;i<op.length;i++) { for(var i=0;i<op.length;i++) {
planned_operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2); var planned_operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
frappe.model.set_value('Production Order Operation',op[i].name, "planned_operating_cost", planned_operating_cost); frappe.model.set_value('Production Order Operation',op[i].name, "planned_operating_cost", planned_operating_cost);
doc.planned_operating_cost += planned_operating_cost; doc.planned_operating_cost += planned_operating_cost;
@ -198,7 +198,7 @@ erpnext.production_order = {
query: "erpnext.controllers.queries.bom", query: "erpnext.controllers.queries.bom",
filters: {item: cstr(doc.production_item)} filters: {item: cstr(doc.production_item)}
} }
} else msgprint(__("Please enter Production Item first")); } else frappe.msgprint(__("Please enter Production Item first"));
}); });
}, },

View File

@ -21,7 +21,6 @@ frappe.ui.form.on("Production Planning Tool", {
onload_post_render: function(frm) { onload_post_render: function(frm) {
frm.get_field("items").grid.set_multiple_add("item_code", "planned_qty"); frm.get_field("items").grid.set_multiple_add("item_code", "planned_qty");
}, },
get_sales_orders: function(frm) { get_sales_orders: function(frm) {
frappe.call({ frappe.call({
doc: frm.doc, doc: frm.doc,
@ -112,7 +111,7 @@ cur_frm.fields_dict['items'].grid.get_field('bom_no').get_query = function(doc,
query: "erpnext.controllers.queries.bom", query: "erpnext.controllers.queries.bom",
filters:{'item': cstr(d.item_code)} filters:{'item': cstr(d.item_code)}
} }
} else msgprint(__("Please enter Item first")); } else frappe.msgprint(__("Please enter Item first"));
} }
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {

View File

@ -10,7 +10,6 @@ frappe.pages['production-analytics'].on_page_load = function(wrapper) {
new erpnext.ProductionAnalytics(wrapper); new erpnext.ProductionAnalytics(wrapper);
frappe.breadcrumbs.add("Manufacturing"); frappe.breadcrumbs.add("Manufacturing");
} }
@ -18,7 +17,6 @@ erpnext.ProductionAnalytics = frappe.views.GridReportWithPlot.extend({
init: function(wrapper) { init: function(wrapper) {
this._super({ this._super({
title: __("Production Analytics"), title: __("Production Analytics"),
page: wrapper,
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
page: wrapper.page, page: wrapper.page,
doctypes: ["Item", "Company", "Fiscal Year", "Production Order"] doctypes: ["Item", "Company", "Fiscal Year", "Production Order"]
@ -73,8 +71,8 @@ erpnext.ProductionAnalytics = frappe.views.GridReportWithPlot.extend({
}, },
set_default_values: function() { set_default_values: function() {
var values = { var values = {
from_date: dateutil.str_to_user(dateutil.add_months(dateutil.now_datetime(),-12) ), from_date: frappe.datetime.str_to_user(frappe.datetime.add_months(frappe.datetime.now_datetime(),-12) ),
to_date: dateutil.str_to_user(dateutil.add_months(dateutil.now_datetime(),1)) to_date: frappe.datetime.str_to_user(frappe.datetime.add_months(frappe.datetime.now_datetime(),1))
} }
var me = this; var me = this;
@ -100,17 +98,17 @@ erpnext.ProductionAnalytics = frappe.views.GridReportWithPlot.extend({
checked:true}; checked:true};
$.each(frappe.report_dump.data["Production Order"], function(i, d) { $.each(frappe.report_dump.data["Production Order"], function(i, d) {
var dateobj = dateutil.str_to_obj(d.creation); var dateobj = frappe.datetime.str_to_obj(d.creation);
var date = dateutil.str_to_user(d.creation.split(" ")[0]); var date = frappe.datetime.str_to_user(d.creation.split(" ")[0]);
$.each(me.columns, function(i,col) { $.each(me.columns, function(i,col) {
if (i > 1){ if (i > 1){
var start_period = dateutil.user_to_obj(dateutil.str_to_user(col.id)); var start_period = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(col.id));
var end_period = dateutil.user_to_obj(dateutil.str_to_user(col.name)); var end_period = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(col.name));
var astart_date = dateutil.user_to_obj(dateutil.str_to_user(d.actual_start_date)); var astart_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.actual_start_date));
var planned_start_date = dateutil.user_to_obj(dateutil.str_to_user(d.planned_start_date)); var planned_start_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.planned_start_date));
var aend_date = dateutil.user_to_obj(dateutil.str_to_user(d.actual_end_date)); var aend_date = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.actual_end_date));
var modified = dateutil.user_to_obj(dateutil.str_to_user(d.modified)); var modified = frappe.datetime.user_to_obj(frappe.datetime.str_to_user(d.modified));
if (dateobj <= start_period || dateobj <= end_period) { if (dateobj <= start_period || dateobj <= end_period) {
all_open_orders[col.field] = flt(all_open_orders[col.field]) + 1; all_open_orders[col.field] = flt(all_open_orders[col.field]) + 1;

View File

@ -1,13 +1,13 @@
frappe.query_reports["BOM Stock Report"] = { frappe.query_reports["BOM Stock Report"] = {
"filters": [ "filters": [
{ {
"fieldname":"bom", "fieldname": "bom",
"label": __("BOM"), "label": __("BOM"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "BOM", "options": "BOM",
"reqd": 1 "reqd": 1
},{ }, {
"fieldname":"warehouse", "fieldname": "warehouse",
"label": __("Warehouse"), "label": __("Warehouse"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Warehouse", "options": "Warehouse",

View File

@ -4,11 +4,10 @@
frappe.query_reports["Production Order Stock Report"] = { frappe.query_reports["Production Order Stock Report"] = {
"filters": [ "filters": [
{ {
"fieldname":"warehouse", "fieldname": "warehouse",
"label": __("Warehouse"), "label": __("Warehouse"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Warehouse" "options": "Warehouse"
} }
] ]
} }

View File

@ -89,7 +89,7 @@ frappe.ui.form.on("Project Task", {
if(doc.task_id) { if(doc.task_id) {
frappe.set_route("Form", "Task", doc.task_id); frappe.set_route("Form", "Task", doc.task_id);
} else { } else {
msgprint(__("Save the document first.")); frappe.msgprint(__("Save the document first."));
} }
}, },
status: function(frm, doctype, name) { status: function(frm, doctype, name) {

View File

@ -13,7 +13,7 @@ frappe.ui.form.on("Timesheet", {
} }
frm.fields_dict['time_logs'].grid.get_field('task').get_query = function(frm, cdt, cdn) { frm.fields_dict['time_logs'].grid.get_field('task').get_query = function(frm, cdt, cdn) {
child = locals[cdt][cdn]; var child = locals[cdt][cdn];
return{ return{
filters: { filters: {
'project': child.project, 'project': child.project,
@ -109,7 +109,7 @@ frappe.ui.form.on("Timesheet Detail", {
}, },
activity_type: function(frm, cdt, cdn) { activity_type: function(frm, cdt, cdn) {
child = locals[cdt][cdn]; var child = locals[cdt][cdn];
frappe.call({ frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_activity_cost", method: "erpnext.projects.doctype.timesheet.timesheet.get_activity_cost",
args: { args: {
@ -127,7 +127,7 @@ frappe.ui.form.on("Timesheet Detail", {
} }
}); });
calculate_end_time = function(frm, cdt, cdn){ var calculate_end_time = function(frm, cdt, cdn) {
var child = locals[cdt][cdn]; var child = locals[cdt][cdn];
var d = moment(child.from_time); var d = moment(child.from_time);
@ -142,8 +142,9 @@ calculate_end_time = function(frm, cdt, cdn){
} }
var calculate_billing_costing_amount = function(frm, cdt, cdn){ var calculate_billing_costing_amount = function(frm, cdt, cdn){
child = locals[cdt][cdn] var child = locals[cdt][cdn]
billing_amount = costing_amount = 0.0; var billing_amount = 0.0;
var costing_amount = 0.0;
if(child.billing_hours && child.billable){ if(child.billing_hours && child.billable){
billing_amount = (child.billing_hours * child.billing_rate); billing_amount = (child.billing_hours * child.billing_rate);
@ -157,10 +158,10 @@ var calculate_billing_costing_amount = function(frm, cdt, cdn){
var calculate_time_and_amount = function(frm) { var calculate_time_and_amount = function(frm) {
var tl = frm.doc.time_logs || []; var tl = frm.doc.time_logs || [];
total_working_hr = 0; var total_working_hr = 0;
total_billing_hr = 0; var total_billing_hr = 0;
total_billable_amount = 0; var total_billable_amount = 0;
total_costing_amount = 0; var total_costing_amount = 0;
for(var i=0; i<tl.length; i++) { for(var i=0; i<tl.length; i++) {
if (tl[i].hours) { if (tl[i].hours) {
total_working_hr += tl[i].hours; total_working_hr += tl[i].hours;

View File

@ -18,7 +18,6 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
init: function(wrapper, title) { init: function(wrapper, title) {
this._super({ this._super({
title: title, title: title,
page: wrapper,
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
page: wrapper.page, page: wrapper.page,
doctypes: ["Company", "Fiscal Year", "Account", "GL Entry", "Cost Center"], doctypes: ["Company", "Fiscal Year", "Account", "GL Entry", "Cost Center"],
@ -77,8 +76,8 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
var fy = $(this).val(); var fy = $(this).val();
$.each(frappe.report_dump.data["Fiscal Year"], function(i, v) { $.each(frappe.report_dump.data["Fiscal Year"], function(i, v) {
if (v.name==fy) { if (v.name==fy) {
me.filter_inputs.from_date.val(dateutil.str_to_user(v.year_start_date)); me.filter_inputs.from_date.val(frappe.datetime.str_to_user(v.year_start_date));
me.filter_inputs.to_date.val(dateutil.str_to_user(v.year_end_date)); me.filter_inputs.to_date.val(frappe.datetime.str_to_user(v.year_end_date));
} }
}); });
me.refresh(); me.refresh();
@ -124,8 +123,8 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
var gl = frappe.report_dump.data['GL Entry']; var gl = frappe.report_dump.data['GL Entry'];
var me = this; var me = this;
this.opening_date = dateutil.user_to_obj(this.filter_inputs.from_date.val()); this.opening_date = frappe.datetime.user_to_obj(this.filter_inputs.from_date.val());
this.closing_date = dateutil.user_to_obj(this.filter_inputs.to_date.val()); this.closing_date = frappe.datetime.user_to_obj(this.filter_inputs.to_date.val());
this.set_fiscal_year(); this.set_fiscal_year();
if (!this.fiscal_year) return; if (!this.fiscal_year) return;
@ -135,7 +134,7 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
}); });
$.each(gl, function(i, v) { $.each(gl, function(i, v) {
var posting_date = dateutil.str_to_obj(v.posting_date); var posting_date = frappe.datetime.str_to_obj(v.posting_date);
var account = me.item_by_name[v.account]; var account = me.item_by_name[v.account];
me.update_balances(account, posting_date, v); me.update_balances(account, posting_date, v);
}); });
@ -146,7 +145,7 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
// opening // opening
if (posting_date < this.opening_date || v.is_opening === "Yes") { if (posting_date < this.opening_date || v.is_opening === "Yes") {
if (account.report_type === "Profit and Loss" && if (account.report_type === "Profit and Loss" &&
posting_date <= dateutil.str_to_obj(this.fiscal_year[1])) { posting_date <= frappe.datetime.str_to_obj(this.fiscal_year[1])) {
// balance of previous fiscal_year should // balance of previous fiscal_year should
// not be part of opening of pl account balance // not be part of opening of pl account balance
} else { } else {
@ -208,21 +207,21 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
set_fiscal_year: function() { set_fiscal_year: function() {
if (this.opening_date > this.closing_date) { if (this.opening_date > this.closing_date) {
msgprint(__("Opening Date should be before Closing Date")); frappe.msgprint(__("Opening Date should be before Closing Date"));
return; return;
} }
this.fiscal_year = null; this.fiscal_year = null;
var me = this; var me = this;
$.each(frappe.report_dump.data["Fiscal Year"], function(i, v) { $.each(frappe.report_dump.data["Fiscal Year"], function(i, v) {
if (me.opening_date >= dateutil.str_to_obj(v.year_start_date) && if (me.opening_date >= frappe.datetime.str_to_obj(v.year_start_date) &&
me.closing_date <= dateutil.str_to_obj(v.year_end_date)) { me.closing_date <= frappe.datetime.str_to_obj(v.year_end_date)) {
me.fiscal_year = v; me.fiscal_year = v;
} }
}); });
if (!this.fiscal_year) { if (!this.fiscal_year) {
msgprint(__("Opening Date and Closing Date should be within same Fiscal Year")); frappe.msgprint(__("Opening Date and Closing Date should be within same Fiscal Year"));
return; return;
} }
}, },

View File

@ -8,7 +8,7 @@ frappe.ui.form.on("Communication", {
}, "Make"); }, "Make");
} }
if(!inList(["Lead", "Opportunity"], frm.doc.reference_doctype)) { if(!in_list(["Lead", "Opportunity"], frm.doc.reference_doctype)) {
frm.add_custom_button(__("Lead"), function() { frm.add_custom_button(__("Lead"), function() {
frappe.confirm("Are you sure you want to create Lead from this email", function(){ frappe.confirm("Are you sure you want to create Lead from this email", function(){
frm.trigger('make_lead_from_communication'); frm.trigger('make_lead_from_communication');

View File

@ -89,7 +89,7 @@ frappe.ui.form.on('Salary Structure', {
} }
}) })
get_payment_mode_account = function(frm, mode_of_payment, callback){ var get_payment_mode_account = function(frm, mode_of_payment, callback){
return frappe.call({ return frappe.call({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account", method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
args: { args: {
@ -108,7 +108,7 @@ get_payment_mode_account = function(frm, mode_of_payment, callback){
cur_frm.cscript.account_head = function(doc, cdt, cdn) { cur_frm.cscript.account_head = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(!d.charge_type && d.account_head){ if(!d.charge_type && d.account_head){
msgprint("Please select Charge Type first"); frappe.msgprint("Please select Charge Type first");
frappe.model.set_value(cdt, cdn, "account_head", ""); frappe.model.set_value(cdt, cdn, "account_head", "");
} else if(d.account_head && d.charge_type!=="Actual") { } else if(d.account_head && d.charge_type!=="Actual") {
frappe.call({ frappe.call({
@ -152,7 +152,7 @@ cur_frm.cscript.validate_taxes_and_charges = function(cdt, cdn) {
} }
} }
if(msg) { if(msg) {
validated = false; frappe.validated = false;
refresh_field("taxes"); refresh_field("taxes");
frappe.throw(msg); frappe.throw(msg);
} }
@ -176,7 +176,8 @@ cur_frm.cscript.validate_inclusive_tax = function(tax) {
// inclusive tax cannot be of type Actual // inclusive tax cannot be of type Actual
actual_type_error(); actual_type_error();
} else if(tax.charge_type == "On Previous Row Amount" && } else if(tax.charge_type == "On Previous Row Amount" &&
!cint(this.frm.doc["taxes"][tax.row_id - 1].included_in_print_rate)) { !cint(this.frm.doc["taxes"][tax.row_id - 1].included_in_print_rate)
) {
// referred row should also be an inclusive tax // referred row should also be an inclusive tax
on_previous_row_error(tax.row_id); on_previous_row_error(tax.row_id);
} else if(tax.charge_type == "On Previous Row Total") { } else if(tax.charge_type == "On Previous Row Total") {

View File

@ -18,9 +18,11 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
this.setup_queries(); this.setup_queries();
this._super(); this._super();
/* eslint-disable */
// no idea where me is coming from
if(this.frm.get_field('shipping_address')) { if(this.frm.get_field('shipping_address')) {
this.frm.set_query("shipping_address", function(){ this.frm.set_query("shipping_address", function() {
if(me.frm.doc.customer){ if(me.frm.doc.customer) {
return { return {
query: 'frappe.geo.doctype.address.address.address_query', query: 'frappe.geo.doctype.address.address.address_query',
filters: { link_doctype: 'Customer', link_name: me.frm.doc.customer } filters: { link_doctype: 'Customer', link_name: me.frm.doc.customer }
@ -29,6 +31,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
return erpnext.queries.company_address_query(me.frm.doc) return erpnext.queries.company_address_query(me.frm.doc)
}); });
} }
/* eslint-enable */
}, },
setup_queries: function() { setup_queries: function() {
@ -206,14 +209,14 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
shipping_address: function(){ shipping_address: function(){
var me = this; var me = this;
erpnext.utils.get_address_display(this.frm, "shipping_address", erpnext.utils.get_address_display(this.frm, "shipping_address",
"shipping_address_display", is_your_company_address=true) "shipping_address_display", true);
}, },
tc_name: function() { tc_name: function() {
this.get_terms(); this.get_terms();
}, },
link_to_mrs: function() { link_to_mrs: function() {
my_items = []; var my_items = [];
for (var i in cur_frm.doc.items) { for (var i in cur_frm.doc.items) {
if(!cur_frm.doc.items[i].material_request){ if(!cur_frm.doc.items[i].material_request){
my_items.push(cur_frm.doc.items[i].item_code); my_items.push(cur_frm.doc.items[i].item_code);
@ -234,7 +237,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
{ {
cur_frm.doc.items[i].material_request = d.mr_name; cur_frm.doc.items[i].material_request = d.mr_name;
cur_frm.doc.items[i].material_request_item = d.mr_item; cur_frm.doc.items[i].material_request_item = d.mr_item;
my_qty = Math.min(qty, d.qty); var my_qty = Math.min(qty, d.qty);
qty = qty - my_qty; qty = qty - my_qty;
d.qty = d.qty - my_qty; d.qty = d.qty - my_qty;
cur_frm.doc.items[i].stock_qty = my_qty*cur_frm.doc.items[i].conversion_factor; cur_frm.doc.items[i].stock_qty = my_qty*cur_frm.doc.items[i].conversion_factor;
@ -247,7 +250,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
var newrow = frappe.model.add_child(cur_frm.doc, cur_frm.doc.items[i].doctype, "items"); var newrow = frappe.model.add_child(cur_frm.doc, cur_frm.doc.items[i].doctype, "items");
item_length++; item_length++;
for (key in cur_frm.doc.items[i]) for (var key in cur_frm.doc.items[i])
{ {
newrow[key] = cur_frm.doc.items[i][key]; newrow[key] = cur_frm.doc.items[i][key];
} }
@ -324,7 +327,7 @@ erpnext.buying.get_items_from_product_bundle = function(frm) {
}); });
dialog.fields_dict.get_items.$input.click(function() { dialog.fields_dict.get_items.$input.click(function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
dialog.hide(); dialog.hide();
return frappe.call({ return frappe.call({

View File

@ -14,7 +14,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
item.rate = flt(item.rate_with_margin , precision("rate", item)); item.rate = flt(item.rate_with_margin , precision("rate", item));
if(item.discount_percentage){ if(item.discount_percentage){
discount_value = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100; var discount_value = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100;
item.rate = flt((item.rate_with_margin) - (discount_value), precision('rate', item)); item.rate = flt((item.rate_with_margin) - (discount_value), precision('rate', item));
} }
}, },
@ -108,13 +108,14 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
$.each(this.frm.doc["taxes"] || [], function(i, tax) { $.each(this.frm.doc["taxes"] || [], function(i, tax) {
tax.item_wise_tax_detail = {}; tax.item_wise_tax_detail = {};
tax_fields = ["total", "tax_amount_after_discount_amount", var tax_fields = ["total", "tax_amount_after_discount_amount",
"tax_amount_for_current_item", "grand_total_for_current_item", "tax_amount_for_current_item", "grand_total_for_current_item",
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"]
if (cstr(tax.charge_type) != "Actual" && if (cstr(tax.charge_type) != "Actual" &&
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) !(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
tax_fields.push("tax_amount"); tax_fields.push("tax_amount");
}
$.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 }); $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0 });
@ -190,7 +191,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
}, },
_get_tax_rate: function(tax, item_tax_map) { _get_tax_rate: function(tax, item_tax_map) {
return (keys(item_tax_map).indexOf(tax.account_head) != -1) ? return (Object.keys(item_tax_map).indexOf(tax.account_head) != -1) ?
flt(item_tax_map[tax.account_head], precision("rate", tax)) : tax.rate; flt(item_tax_map[tax.account_head], precision("rate", tax)) : tax.rate;
}, },
@ -236,8 +237,9 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
// accumulate tax amount into tax.tax_amount // accumulate tax amount into tax.tax_amount
if (tax.charge_type != "Actual" && if (tax.charge_type != "Actual" &&
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) !(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
tax.tax_amount += current_tax_amount; tax.tax_amount += current_tax_amount;
}
// store tax_amount for current item as it will be used for // store tax_amount for current item as it will be used for
// charge type = 'On Previous Row Amount' // charge type = 'On Previous Row Amount'
@ -492,7 +494,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
if (tax.charge_type == "Actual") if (tax.charge_type == "Actual")
actual_taxes_dict[tax.idx] = tax.tax_amount; actual_taxes_dict[tax.idx] = tax.tax_amount;
else if (actual_taxes_dict[tax.row_id] !== null) { else if (actual_taxes_dict[tax.row_id] !== null) {
actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100; var actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100;
actual_taxes_dict[tax.idx] = actual_tax_amount; actual_taxes_dict[tax.idx] = actual_tax_amount;
} }
}); });
@ -571,7 +573,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
set_default_payment: function(total_amount_to_pay, update_paid_amount){ set_default_payment: function(total_amount_to_pay, update_paid_amount){
var me = this; var me = this;
payment_status = true; var payment_status = true;
if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){ if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
$.each(this.frm.doc['payments'] || [], function(index, data){ $.each(this.frm.doc['payments'] || [], function(index, data){
if(data.type == "Cash" && payment_status && total_amount_to_pay > 0) { if(data.type == "Cash" && payment_status && total_amount_to_pay > 0) {
@ -587,7 +589,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
calculate_paid_amount: function(){ calculate_paid_amount: function(){
var me = this; var me = this;
var paid_amount = base_paid_amount = 0.0; var paid_amount = 0.0;
var base_paid_amount = 0.0;
if(this.frm.doc.is_pos) { if(this.frm.doc.is_pos) {
$.each(this.frm.doc['payments'] || [], function(index, data){ $.each(this.frm.doc['payments'] || [], function(index, data){
data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount")); data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));

View File

@ -102,7 +102,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
onload: function() { onload: function() {
var me = this; var me = this;
if(this.frm.doc.__islocal) { if(this.frm.doc.__islocal) {
var today = get_today(), var today = frappe.datetime.get_today(),
currency = frappe.defaults.get_user_default("currency"); currency = frappe.defaults.get_user_default("currency");
$.each({ $.each({
@ -243,7 +243,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}, },
send_sms: function() { send_sms: function() {
var sms_man = new SMSManager(this.frm.doc); var sms_man = new erpnext.SMSManager(this.frm.doc);
}, },
barcode: function(doc, cdt, cdn) { barcode: function(doc, cdt, cdn) {
@ -281,8 +281,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
currency: me.frm.doc.currency, currency: me.frm.doc.currency,
update_stock: in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0, update_stock: in_list(['Sales Invoice', 'Purchase Invoice'], me.frm.doc.doctype) ? cint(me.frm.doc.update_stock) : 0,
conversion_rate: me.frm.doc.conversion_rate, conversion_rate: me.frm.doc.conversion_rate,
price_list: me.frm.doc.selling_price_list || price_list: me.frm.doc.selling_price_list || me.frm.doc.buying_price_list,
me.frm.doc.buying_price_list,
price_list_currency: me.frm.doc.price_list_currency, price_list_currency: me.frm.doc.price_list_currency,
plc_conversion_rate: me.frm.doc.plc_conversion_rate, plc_conversion_rate: me.frm.doc.plc_conversion_rate,
company: me.frm.doc.company, company: me.frm.doc.company,
@ -426,7 +425,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
erpnext.utils.get_shipping_address(this.frm, function(){ erpnext.utils.get_shipping_address(this.frm, function(){
set_party_account(set_pricing); set_party_account(set_pricing);
}) })
}else{ } else {
set_party_account(set_pricing); set_party_account(set_pricing);
} }
@ -981,7 +980,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
$.each(["company", "customer"], function(i, fieldname) { $.each(["company", "customer"], function(i, fieldname) {
if(frappe.meta.has_field(me.frm.doc.doctype, fieldname && me.frm.doc.doctype != "Purchase Order")) { if(frappe.meta.has_field(me.frm.doc.doctype, fieldname && me.frm.doc.doctype != "Purchase Order")) {
if (!me.frm.doc[fieldname]) { if (!me.frm.doc[fieldname]) {
msgprint(__("Please specify") + ": " + frappe.msgprint(__("Please specify") + ": " +
frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) +
". " + __("It is needed to fetch Item Details.")); ". " + __("It is needed to fetch Item Details."));
valid = false; valid = false;
@ -1076,7 +1075,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
set_gross_profit: function(item) { set_gross_profit: function(item) {
if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) { if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) {
rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1); var rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1);
item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item)); item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item));
} }
}, },
@ -1085,9 +1084,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
// TODO: remove item selector // TODO: remove item selector
return; return;
if(!this.item_selector) { // if(!this.item_selector) {
this.item_selector = new erpnext.ItemSelector({frm: this.frm}); // this.item_selector = new erpnext.ItemSelector({frm: this.frm});
} // }
}, },
get_advances: function() { get_advances: function() {
@ -1118,7 +1117,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}, },
get_method_for_payment: function(){ get_method_for_payment: function(){
method = "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry" var method = "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry"
if(cur_frm.doc.__onload && cur_frm.doc.__onload.make_payment_via_journal_entry){ if(cur_frm.doc.__onload && cur_frm.doc.__onload.make_payment_via_journal_entry){
if(in_list(['Sales Invoice', 'Purchase Invoice'], cur_frm.doc.doctype)){ if(in_list(['Sales Invoice', 'Purchase Invoice'], cur_frm.doc.doctype)){
method = "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_invoice" method = "erpnext.accounts.doctype.journal_entry.journal_entry.get_payment_entry_against_invoice"

View File

@ -55,7 +55,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
show_payment_details: function(){ show_payment_details: function(){
var me = this; var me = this;
multimode_payments = $(this.$body).find('.multimode-payments').empty(); var multimode_payments = $(this.$body).find('.multimode-payments').empty();
if(this.frm.doc.payments.length){ if(this.frm.doc.payments.length){
$.each(this.frm.doc.payments, function(index, data){ $.each(this.frm.doc.payments, function(index, data){
$(frappe.render_template('payment_details', { $(frappe.render_template('payment_details', {
@ -126,7 +126,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
highlight_selected_row: function(){ highlight_selected_row: function(){
var me = this; var me = this;
selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']",{'idx': this.idx})); var selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']",{'idx': this.idx}));
$(this.$body).find('.pos-payment-row').removeClass('selected-payment-mode') $(this.$body).find('.pos-payment-row').removeClass('selected-payment-mode')
selected_row.addClass('selected-payment-mode') selected_row.addClass('selected-payment-mode')
$(this.$body).find('.amount').attr('disabled', true); $(this.$body).find('.amount').attr('disabled', true);
@ -195,7 +195,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
update_paid_amount: function(update_write_off) { update_paid_amount: function(update_write_off) {
var me = this; var me = this;
if(in_list(['change_amount', 'write_off_amount'], this.idx)){ if(in_list(['change_amount', 'write_off_amount'], this.idx)){
value = me.selected_mode.val(); var value = me.selected_mode.val();
if(me.idx == 'change_amount'){ if(me.idx == 'change_amount'){
me.change_amount(value) me.change_amount(value)
} else{ } else{

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
var get_filters = function(){ erpnext.get_purchase_trends_filters = function() {
return [ return [
{ {
"fieldname":"period", "fieldname":"period",
@ -44,7 +44,7 @@ var get_filters = function(){
"label": __("Fiscal Year"), "label": __("Fiscal Year"),
"fieldtype": "Link", "fieldtype": "Link",
"options":'Fiscal Year', "options":'Fiscal Year',
"default": sys_defaults.fiscal_year "default": frappe.sys_defaults.fiscal_year
}, },
{ {
"fieldname":"company", "fieldname":"company",

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
var get_filters = function(){ erpnext.get_sales_trends_filters = function() {
return[ return[
{ {
"fieldname":"period", "fieldname":"period",
@ -45,7 +45,7 @@ var get_filters = function(){
"label": __("Fiscal Year"), "label": __("Fiscal Year"),
"fieldtype": "Link", "fieldtype": "Link",
"options":'Fiscal Year', "options":'Fiscal Year',
"default": sys_defaults.fiscal_year "default": frappe.sys_defaults.fiscal_year
}, },
{ {
"fieldname":"company", "fieldname":"company",

View File

@ -1,7 +1,7 @@
frappe.provide("erpnext.wiz"); frappe.provide("erpnext.wiz");
frappe.pages['setup-wizard'].on_page_load = function(wrapper) { frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
if(sys_defaults.company) { if(frappe.sys_defaults.company) {
frappe.set_route("desk"); frappe.set_route("desk");
return; return;
} }
@ -75,12 +75,12 @@ function load_erpnext_slides() {
validate: function() { validate: function() {
// validate fiscal year start and end dates // validate fiscal year start and end dates
if (this.values.fy_start_date=='Invalid date' || this.values.fy_end_date=='Invalid date') { if (this.values.fy_start_date=='Invalid date' || this.values.fy_end_date=='Invalid date') {
msgprint(__("Please enter valid Financial Year Start and End Dates")); frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
return false; return false;
} }
if ((this.values.company_name || "").toLowerCase() == "company") { if ((this.values.company_name || "").toLowerCase() == "company") {
msgprint(__("Company Name cannot be Company")); frappe.msgprint(__("Company Name cannot be Company"));
return false; return false;
} }
@ -102,7 +102,7 @@ function load_erpnext_slides() {
} }
var year_start_date = current_year + "-" + fy[0]; var year_start_date = current_year + "-" + fy[0];
if(year_start_date > get_today()) { if(year_start_date > frappe.datetime.get_today()) {
next_year = current_year next_year = current_year
current_year -= 1; current_year -= 1;
} }
@ -145,7 +145,7 @@ function load_erpnext_slides() {
slide.get_input("company_abbr").on("change", function() { slide.get_input("company_abbr").on("change", function() {
if(slide.get_input("company_abbr").val().length > 5) { if(slide.get_input("company_abbr").val().length > 5) {
msgprint("Company Abbreviation cannot have more than 5 characters"); frappe.msgprint("Company Abbreviation cannot have more than 5 characters");
slide.get_field("company_abbr").set_input(""); slide.get_field("company_abbr").set_input("");
} }
}); });
@ -420,7 +420,7 @@ function load_erpnext_slides() {
"Thailand": ["10-01", "09-30"], "Thailand": ["10-01", "09-30"],
"United Kingdom": ["04-01", "03-31"], "United Kingdom": ["04-01", "03-31"],
}; };
}; }
frappe.wiz.on("before_load", function() { frappe.wiz.on("before_load", function() {
load_erpnext_slides(); load_erpnext_slides();
@ -447,7 +447,7 @@ frappe.wiz.on("before_load", function() {
} }
}); });
test_values_edu = { var test_values_edu = {
"language":"english", "language":"english",
"domain":"Education", "domain":"Education",
"country":"India", "country":"India",

View File

@ -2,9 +2,11 @@
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
// shopping cart // shopping cart
frappe.provide("shopping_cart"); frappe.provide("erpnext.shopping_cart");
var shopping_cart = erpnext.shopping_cart;
frappe.ready(function() { frappe.ready(function() {
var full_name = frappe.session.user_fullname;
// update user // update user
if(full_name) { if(full_name) {
$('.navbar li[data-label="User"] a') $('.navbar li[data-label="User"] a')
@ -34,6 +36,7 @@ $.extend(shopping_cart, {
}, },
update_cart: function(opts) { update_cart: function(opts) {
var full_name = frappe.session.user_fullname;
if(!full_name || full_name==="Guest") { if(!full_name || full_name==="Guest") {
if(localStorage) { if(localStorage) {
localStorage.setItem("last_visited", window.location.pathname); localStorage.setItem("last_visited", window.location.pathname);
@ -110,7 +113,7 @@ $.extend(shopping_cart, {
}, },
bind_dropdown_cart_buttons: function() { bind_dropdown_cart_buttons: function () {
$(".cart-icon").on('click', '.number-spinner button', function () { $(".cart-icon").on('click', '.number-spinner button', function () {
var btn = $(this), var btn = $(this),
input = btn.closest('.number-spinner').find('input'), input = btn.closest('.number-spinner').find('input'),

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
function SMSManager(doc) { erpnext.SMSManager = function SMSManager(doc) {
var me = this; var me = this;
this.setup = function() { this.setup = function() {
var default_msg = { var default_msg = {
@ -42,7 +42,7 @@ function SMSManager(doc) {
ref_name: ref_name ref_name: ref_name
}, },
callback: function(r) { callback: function(r) {
if(r.exc) { msgprint(r.exc); return; } if(r.exc) { frappe.msgprint(r.exc); return; }
me.number = r.message; me.number = r.message;
me.show_dialog(); me.show_dialog();
} }
@ -92,7 +92,7 @@ function SMSManager(doc) {
}, },
callback: function(r) { callback: function(r) {
$(btn).done_working(); $(btn).done_working();
if(r.exc) {msgprint(r.exc); return; } if(r.exc) {frappe.msgprint(r.exc); return; }
me.dialog.hide(); me.dialog.hide();
} }
}); });

View File

@ -6,7 +6,6 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
init: function(wrapper, opts) { init: function(wrapper, opts) {
var args = { var args = {
title: __("Stock Analytics"), title: __("Stock Analytics"),
page: wrapper,
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
page: wrapper.page, page: wrapper.page,
doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand", doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
@ -120,8 +119,8 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
}, },
prepare_balances: function() { prepare_balances: function() {
var me = this; var me = this;
var from_date = dateutil.str_to_obj(this.from_date); var from_date = frappe.datetime.str_to_obj(this.from_date);
var to_date = dateutil.str_to_obj(this.to_date); var to_date = frappe.datetime.str_to_obj(this.to_date);
var data = frappe.report_dump.data["Stock Ledger Entry"]; var data = frappe.report_dump.data["Stock Ledger Entry"];
this.item_warehouse = {}; this.item_warehouse = {};
@ -130,7 +129,7 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
for(var i=0, j=data.length; i<j; i++) { for(var i=0, j=data.length; i<j; i++) {
var sl = data[i]; var sl = data[i];
sl.posting_datetime = sl.posting_date + " " + sl.posting_time; sl.posting_datetime = sl.posting_date + " " + sl.posting_time;
var posting_datetime = dateutil.str_to_obj(sl.posting_datetime); var posting_datetime = frappe.datetime.str_to_obj(sl.posting_datetime);
if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) { if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) {
var item = me.item_by_name[sl.item_code]; var item = me.item_by_name[sl.item_code];
@ -139,7 +138,7 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
if(me.value_or_qty!="Quantity") { if(me.value_or_qty!="Quantity") {
var wh = me.get_item_warehouse(sl.warehouse, sl.item_code); var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
var valuation_method = item.valuation_method ? var valuation_method = item.valuation_method ?
item.valuation_method : sys_defaults.valuation_method; item.valuation_method : frappe.sys_defaults.valuation_method;
var is_fifo = valuation_method == "FIFO"; var is_fifo = valuation_method == "FIFO";
if(sl.voucher_type=="Stock Reconciliation") { if(sl.voucher_type=="Stock Reconciliation") {
@ -185,7 +184,7 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
var parent = me.parent_map[item.name]; var parent = me.parent_map[item.name];
while(parent) { while(parent) {
parent_group = me.item_by_name[parent]; var parent_group = me.item_by_name[parent];
$.each(me.columns, function(c, col) { $.each(me.columns, function(c, col) {
if (col.formatter == me.currency_formatter) { if (col.formatter == me.currency_formatter) {
parent_group[col.field] = parent_group[col.field] =

View File

@ -248,7 +248,7 @@ $(document).on('app_ready', function() {
"Delivery Note", "Purchase Receipt", "Sales Invoice"], function(i, d) { "Delivery Note", "Purchase Receipt", "Sales Invoice"], function(i, d) {
frappe.ui.form.on(d, "onload", function(frm) { frappe.ui.form.on(d, "onload", function(frm) {
cur_frm.set_df_property("posting_time", "description", cur_frm.set_df_property("posting_time", "description",
sys_defaults.time_zone); frappe.sys_defaults.time_zone);
}); });
}); });
} }

View File

@ -55,7 +55,7 @@ erpnext.ItemSelector = Class.extend({
$.each(this.frm.doc.items || [], function(i, d) { $.each(this.frm.doc.items || [], function(i, d) {
if(d.item_code===item_code) { if(d.item_code===item_code) {
frappe.model.set_value(d.doctype, d.name, 'qty', d.qty + 1); frappe.model.set_value(d.doctype, d.name, 'qty', d.qty + 1);
show_alert(__("Added {0} ({1})", [item_code, d.qty])); frappe.show_alert(__("Added {0} ({1})", [item_code, d.qty]));
added = true; added = true;
return false; return false;
} }
@ -69,7 +69,7 @@ erpnext.ItemSelector = Class.extend({
frappe.after_ajax(function() { frappe.after_ajax(function() {
setTimeout(function() { setTimeout(function() {
frappe.model.set_value(d.doctype, d.name, 'qty', 1); frappe.model.set_value(d.doctype, d.name, 'qty', 1);
show_alert(__("Added {0} ({1})", [item_code, 1])); frappe.show_alert(__("Added {0} ({1})", [item_code, 1]));
}, 100); }, 100);
}); });
} }

View File

@ -57,7 +57,7 @@ erpnext.utils.add_item = function(frm) {
var prev_route = frappe.get_prev_route(); var prev_route = frappe.get_prev_route();
if(prev_route[1]==='Item' && !(frm.doc.items && frm.doc.items.length)) { if(prev_route[1]==='Item' && !(frm.doc.items && frm.doc.items.length)) {
// add row // add row
item = frm.add_child('items'); var item = frm.add_child('items');
frm.refresh_field('items'); frm.refresh_field('items');
// set item // set item

View File

@ -31,7 +31,7 @@ frappe.ui.form.on("Assessment Result Detail", {
score: function(frm, cdt, cdn) { score: function(frm, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if (d.score >= d.maximum_score) { if (d.score >= d.maximum_score) {
frappe.throw(_("Score cannot be greater than Maximum Score")); frappe.throw(__("Score cannot be greater than Maximum Score"));
} }
else { else {
frappe.call({ frappe.call({

View File

@ -1,6 +1,6 @@
frappe.ui.form.on("Fee Component", { frappe.ui.form.on("Fee Component", {
amount: function(frm) { amount: function(frm) {
total_amount = 0; var total_amount = 0;
for(var i=0;i<frm.doc.components.length;i++) { for(var i=0;i<frm.doc.components.length;i++) {
total_amount += frm.doc.components[i].amount; total_amount += frm.doc.components[i].amount;
} }

View File

@ -88,7 +88,7 @@ frappe.ui.form.on("Fees", {
}, },
calculate_total_amount: function(frm) { calculate_total_amount: function(frm) {
total_amount = 0; var total_amount = 0;
for(var i=0;i<frm.doc.components.length;i++) { for(var i=0;i<frm.doc.components.length;i++) {
total_amount += frm.doc.components[i].amount; total_amount += frm.doc.components[i].amount;
} }

View File

@ -1,8 +1,9 @@
frappe.listview_settings['Fees'] = { frappe.listview_settings['Fees'] = {
add_fields: [ "total_amount", "paid_amount", "due_date"], add_fields: [ "total_amount", "paid_amount", "due_date"],
get_indicator: function(doc) { get_indicator: function(doc) {
var { get_today } = frappe.datetime;
if ((doc.total_amount > doc.paid_amount) && doc.due_date < get_today()) { if ((doc.total_amount > doc.paid_amount) && doc.due_date < get_today()) {
return [__("Overdue"), "red", ["due_date,<,"+get_today()], ["due_date,<,"+get_today()]]; return [__("Overdue"), "red", ["due_date,<," + get_today()], ["due_date,<," + get_today()]];
} }
else if (doc.total_amount > doc.paid_amount) { else if (doc.total_amount > doc.paid_amount) {
return [__("Pending"), "orange"]; return [__("Pending"), "orange"];

View File

@ -28,7 +28,7 @@ frappe.ui.form.on("Student Applicant", {
frappe.realtime.on("enroll_student_progress", function(data) { frappe.realtime.on("enroll_student_progress", function(data) {
if(data.progress) { if(data.progress) {
frappe.hide_msgprint(true); frappe.hide_frappe.msgprint(true);
frappe.show_progress(__("Enrolling student"), data.progress[0],data.progress[1]); frappe.show_progress(__("Enrolling student"), data.progress[0],data.progress[1]);
} }
}) })

View File

@ -98,17 +98,6 @@ schools.StudentsEditor = Class.extend({
}); });
}); });
var get_present_student = function(student) {
return students.filter(function(s) {
return s.group_roll_number === group_roll_number;
})
}
var get_absent_student = function(group_roll_number) {
return students.filter(function(s) {
return s.group_roll_number === group_roll_number;
})
}
student_toolbar.find(".btn-mark-att") student_toolbar.find(".btn-mark-att")
.html(__('Mark Attendence')) .html(__('Mark Attendence'))
.on("click", function() { .on("click", function() {

View File

@ -8,7 +8,7 @@ frappe.ui.form.on("Student Group Creation Tool", "refresh", function(frm) {
}); });
frappe.realtime.on("student_group_creation_progress", function(data) { frappe.realtime.on("student_group_creation_progress", function(data) {
if(data.progress) { if(data.progress) {
frappe.hide_msgprint(true); frappe.hide_frappe.msgprint(true);
frappe.show_progress(__("Creating student groups"), data.progress[0],data.progress[1]); frappe.show_progress(__("Creating student groups"), data.progress[0],data.progress[1]);
} }
}); });

View File

@ -8,7 +8,7 @@ frappe.query_reports["Absent Student Report"] = {
"fieldname":"date", "fieldname":"date",
"label": __("Date"), "label": __("Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today(), "default": frappe.datetime.get_today(),
"reqd": 1 "reqd": 1
} }
] ]

View File

@ -6,7 +6,7 @@ frappe.query_reports["Student Batch-Wise Attendance"] = {
"fieldname": "date", "fieldname": "date",
"label": __("Date"), "label": __("Date"),
"fieldtype": "Date", "fieldtype": "Date",
"default": get_today(), "default": frappe.datetime.get_today(),
"reqd": 1 "reqd": 1
}] }]
} }

View File

@ -16,9 +16,13 @@ frappe.provide("erpnext.selling");
// TODO commonify this code // TODO commonify this code
erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
if(!this.frm.doc.status) set_multiple(dt,dn,{ status:'Draft'}); if(!this.frm.doc.status) {
if(this.frm.doc.__islocal) set_multiple(this.frm.doc.doctype, this.frm.doc.name, set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Draft'});
{inst_date: get_today()}); }
if(this.frm.doc.__islocal) {
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
{inst_date: frappe.datetime.get_today()});
}
this.setup_queries(); this.setup_queries();
}, },

View File

@ -94,7 +94,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
validate_company_and_party: function(party_field) { validate_company_and_party: function(party_field) {
if(!this.frm.doc.quotation_to) { if(!this.frm.doc.quotation_to) {
msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name])); frappe.msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name]));
return false; return false;
} else if (this.frm.doc.quotation_to == "Lead") { } else if (this.frm.doc.quotation_to == "Lead") {
return true; return true;
@ -149,7 +149,7 @@ cur_frm.cscript['Declare Order Lost'] = function(){
}); });
dialog.fields_dict.update.$input.click(function() { dialog.fields_dict.update.$input.click(function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
return cur_frm.call({ return cur_frm.call({
method: "declare_order_lost", method: "declare_order_lost",
@ -157,7 +157,7 @@ cur_frm.cscript['Declare Order Lost'] = function(){
args: args.reason, args: args.reason,
callback: function(r) { callback: function(r) {
if(r.exc) { if(r.exc) {
msgprint(__("There were errors.")); frappe.msgprint(__("There were errors."));
return; return;
} }
dialog.hide(); dialog.hide();

View File

@ -196,7 +196,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
title: __('Select Items to Manufacture'), title: __('Select Items to Manufacture'),
fields: fields, fields: fields,
primary_action: function() { primary_action: function() {
data = d.get_values(); var data = d.get_values();
me.frm.call({ me.frm.call({
method: 'make_production_orders', method: 'make_production_orders',
args: { args: {
@ -288,7 +288,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
}); });
dialog.fields_dict.make_purchase_order.$input.click(function() { dialog.fields_dict.make_purchase_order.$input.click(function() {
args = dialog.get_values(); var args = dialog.get_values();
if(!args) return; if(!args) return;
dialog.hide(); dialog.hide();
return frappe.call({ return frappe.call({

View File

@ -18,7 +18,6 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
init: function(wrapper) { init: function(wrapper) {
this._super({ this._super({
title: __("Sales Analytics"), title: __("Sales Analytics"),
page: wrapper,
parent: $(wrapper).find('.layout-main'), parent: $(wrapper).find('.layout-main'),
page: wrapper.page, page: wrapper.page,
doctypes: ["Item", "Item Group", "Customer", "Customer Group", "Company", "Territory", doctypes: ["Item", "Item Group", "Customer", "Customer Group", "Company", "Territory",
@ -194,13 +193,13 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
}, },
prepare_balances: function() { prepare_balances: function() {
var me = this; var me = this;
var from_date = dateutil.str_to_obj(this.from_date); var from_date = frappe.datetime.str_to_obj(this.from_date);
var to_date = dateutil.str_to_obj(this.to_date); var to_date = frappe.datetime.str_to_obj(this.to_date);
var is_val = this.value_or_qty == 'Value'; var is_val = this.value_or_qty == 'Value';
$.each(this.tl[this.based_on], function(i, tl) { $.each(this.tl[this.based_on], function(i, tl) {
if (me.is_default('company') ? true : tl.company === me.company) { 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) { if (posting_date >= from_date && posting_date <= to_date) {
var item = me.item_by_name[tl[me.tree_grid.item_key]] || var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
me.item_by_name['Not Set']; me.item_by_name['Not Set'];
@ -217,7 +216,7 @@ erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
$.each(this.data, function(i, item) { $.each(this.data, function(i, item) {
var parent = me.parent_map[item.name]; var parent = me.parent_map[item.name];
while(parent) { while(parent) {
parent_group = me.item_by_name[parent]; var parent_group = me.item_by_name[parent];
$.each(me.columns, function(c, col) { $.each(me.columns, function(c, col) {
if (col.formatter == me.currency_formatter) { if (col.formatter == me.currency_formatter) {

View File

@ -3,7 +3,7 @@
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() { frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.query_reports["Quotation Trends"] = { frappe.query_reports["Quotation Trends"] = {
filters: get_filters() filters: erpnext.get_sales_trends_filters()
} }
}); });

View File

@ -3,6 +3,6 @@
frappe.require("assets/erpnext/js/sales_trends_filters.js", function() { frappe.require("assets/erpnext/js/sales_trends_filters.js", function() {
frappe.query_reports["Sales Order Trends"] = { frappe.query_reports["Sales Order Trends"] = {
filters: get_filters() filters: erpnext.get_sales_trends_filters()
} }
}); });

View File

@ -8,7 +8,7 @@ frappe.query_reports["Sales Person Target Variance Item Group-Wise"] = {
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: sys_defaults.fiscal_year default: frappe.sys_defaults.fiscal_year
}, },
{ {
fieldname: "period", fieldname: "period",

Some files were not shown because too many files have changed in this diff Show More