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

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