Merge branch 'develop'
This commit is contained in:
commit
74f64b67db
@ -95,9 +95,10 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
|||||||
wn.route_options = {
|
wn.route_options = {
|
||||||
"account": doc.name,
|
"account": doc.name,
|
||||||
"from_date": sys_defaults.year_start_date,
|
"from_date": sys_defaults.year_start_date,
|
||||||
"to_date": sys_defaults.year_end_date
|
"to_date": sys_defaults.year_end_date,
|
||||||
|
"company": doc.company
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,9 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
"voucher_no": doc.name,
|
"voucher_no": doc.name,
|
||||||
"from_date": doc.posting_date,
|
"from_date": doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": doc.posting_date,
|
||||||
|
"company": doc.company
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
"voucher_no": doc.name,
|
"voucher_no": doc.name,
|
||||||
"from_date": doc.posting_date,
|
"from_date": doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": doc.posting_date,
|
||||||
|
"company": doc.company
|
||||||
};
|
};
|
||||||
wn.set_route("query-report/General Ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
"voucher_no": doc.name,
|
"voucher_no": doc.name,
|
||||||
"from_date": doc.posting_date,
|
"from_date": doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": doc.posting_date,
|
||||||
|
"company": doc.company
|
||||||
};
|
};
|
||||||
wn.set_route("query-report/General Ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
|
|
||||||
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
|
var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
|
||||||
|
@ -175,9 +175,10 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
wn.route_options = {
|
wn.route_options = {
|
||||||
"account": node.data('label'),
|
"account": node.data('label'),
|
||||||
"from_date": sys_defaults.year_start_date,
|
"from_date": sys_defaults.year_start_date,
|
||||||
"to_date": sys_defaults.year_end_date
|
"to_date": sys_defaults.year_end_date,
|
||||||
|
"company": me.company
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
},
|
},
|
||||||
rename: function() {
|
rename: function() {
|
||||||
var node = this.selected_node();
|
var node = this.selected_node();
|
||||||
|
@ -8,7 +8,9 @@ from webnotes import _
|
|||||||
from accounts.utils import get_balance_on
|
from accounts.utils import get_balance_on
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
validate_filters(filters)
|
account_details = webnotes.conn.get_value("Account", filters["account"],
|
||||||
|
["debit_or_credit", "group_or_ledger"], as_dict=True)
|
||||||
|
validate_filters(filters, account_details.group_or_ledger)
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
data = []
|
data = []
|
||||||
if filters.get("group_by"):
|
if filters.get("group_by"):
|
||||||
@ -19,12 +21,13 @@ def execute(filters=None):
|
|||||||
data.append(get_total_row(data))
|
data.append(get_total_row(data))
|
||||||
|
|
||||||
if filters.get("account"):
|
if filters.get("account"):
|
||||||
data = [get_opening_balance_row(filters)] + data + [get_closing_balance_row(filters)]
|
data = [get_opening_balance_row(filters, account_details.debit_or_credit)] + data + \
|
||||||
|
[get_closing_balance_row(filters, account_details.debit_or_credit)]
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def validate_filters(filters):
|
def validate_filters(filters, group_or_ledger):
|
||||||
if filters.get("account") and filters.get("group_by") == "Group by Account":
|
if group_or_ledger == "Ledger" and filters.get("group_by") == "Group by Account":
|
||||||
webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
|
webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
|
||||||
|
|
||||||
if filters.get("voucher_no") and filters.get("group_by") == "Group by Voucher":
|
if filters.get("voucher_no") and filters.get("group_by") == "Group by Voucher":
|
||||||
@ -35,13 +38,19 @@ def get_columns():
|
|||||||
"Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20",
|
"Credit:Float:100", "Voucher Type::120", "Voucher No::160", "Link::20",
|
||||||
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
||||||
|
|
||||||
def get_opening_balance_row(filters):
|
def get_opening_balance_row(filters, debit_or_credit):
|
||||||
opening_balance = get_balance_on(filters["account"], add_days(filters["from_date"], -1))
|
opening_balance = get_balance_on(filters["account"], add_days(filters["from_date"], -1))
|
||||||
return ["", "Opening Balance", opening_balance, 0.0, "", "", ""]
|
return get_balance_row(opening_balance, debit_or_credit, "Opening Balance")
|
||||||
|
|
||||||
def get_closing_balance_row(filters):
|
def get_closing_balance_row(filters, debit_or_credit):
|
||||||
closing_balance = get_balance_on(filters["account"], filters["to_date"])
|
closing_balance = get_balance_on(filters["account"], filters["to_date"])
|
||||||
return ["", "Closing Balance", closing_balance, 0.0, "", "", ""]
|
return get_balance_row(closing_balance, debit_or_credit, "Closing Balance")
|
||||||
|
|
||||||
|
def get_balance_row(balance, debit_or_credit, balance_label):
|
||||||
|
if debit_or_credit == "Debit":
|
||||||
|
return ["", balance_label, balance, 0.0, "", "", ""]
|
||||||
|
else:
|
||||||
|
return ["", balance_label, 0.0, balance, "", "", ""]
|
||||||
|
|
||||||
def get_gl_entries(filters):
|
def get_gl_entries(filters):
|
||||||
gl_entries = webnotes.conn.sql("""select
|
gl_entries = webnotes.conn.sql("""select
|
||||||
@ -63,7 +72,9 @@ def get_gl_entries(filters):
|
|||||||
def get_conditions(filters):
|
def get_conditions(filters):
|
||||||
conditions = []
|
conditions = []
|
||||||
if filters.get("account"):
|
if filters.get("account"):
|
||||||
conditions.append("account=%(account)s")
|
lft, rgt = webnotes.conn.get_value("Account", filters["account"], ["lft", "rgt"])
|
||||||
|
conditions.append("""account in (select name from tabAccount
|
||||||
|
where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
|
||||||
if filters.get("voucher_no"):
|
if filters.get("voucher_no"):
|
||||||
conditions.append("voucher_no=%(voucher_no)s")
|
conditions.append("voucher_no=%(voucher_no)s")
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class BudgetError(webnotes.ValidationError): pass
|
|||||||
|
|
||||||
|
|
||||||
def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1):
|
def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1):
|
||||||
return get_fiscal_years(date, fiscal_year, label, verbose=1)[0]
|
return get_fiscal_years(date, fiscal_year, label, verbose)[0]
|
||||||
|
|
||||||
def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1):
|
def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1):
|
||||||
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
|
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"app_name": "ERPNext",
|
"app_name": "ERPNext",
|
||||||
"app_version": "3.3.6",
|
"app_version": "3.3.7",
|
||||||
"base_template": "app/portal/templates/base.html",
|
"base_template": "app/portal/templates/base.html",
|
||||||
"modules": {
|
"modules": {
|
||||||
"Accounts": {
|
"Accounts": {
|
||||||
@ -74,5 +74,5 @@
|
|||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"requires_framework_version": "==3.3.1"
|
"requires_framework_version": "==3.3.2"
|
||||||
}
|
}
|
@ -26,9 +26,10 @@ erpnext.AccountTreeGrid = wn.views.TreeGridReport.extend({
|
|||||||
show: true,
|
show: true,
|
||||||
parent_field: "parent_account",
|
parent_field: "parent_account",
|
||||||
formatter: function(item) {
|
formatter: function(item) {
|
||||||
return repl('<a href="#general-ledger/account=%(enc_value)s">%(value)s</a>', {
|
return repl("<a \
|
||||||
|
onclick='wn.cur_grid_report.show_general_ledger(\"%(value)s\")'>\
|
||||||
|
%(value)s</a>", {
|
||||||
value: item.name,
|
value: item.name,
|
||||||
enc_value: encodeURIComponent(item.name)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -211,4 +212,14 @@ erpnext.AccountTreeGrid = wn.views.TreeGridReport.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
show_general_ledger: function(account) {
|
||||||
|
wn.route_options = {
|
||||||
|
account: account,
|
||||||
|
company: this.company,
|
||||||
|
from_date: this.from_date,
|
||||||
|
to_date: this.to_date
|
||||||
|
};
|
||||||
|
wn.set_route("query-report", "General Ledger");
|
||||||
|
}
|
||||||
});
|
});
|
@ -11,9 +11,10 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
wn.route_options = {
|
wn.route_options = {
|
||||||
voucher_no: me.frm.doc.name,
|
voucher_no: me.frm.doc.name,
|
||||||
from_date: me.frm.doc.posting_date,
|
from_date: me.frm.doc.posting_date,
|
||||||
to_date: me.frm.doc.posting_date
|
to_date: me.frm.doc.posting_date,
|
||||||
|
company: me.frm.doc.company
|
||||||
};
|
};
|
||||||
wn.set_route('stock-ledger');
|
wn.set_route("query-report", "Stock Ledger");
|
||||||
}, "icon-bar-chart");
|
}, "icon-bar-chart");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,11 +25,12 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
|||||||
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
||||||
cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
|
cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
|
||||||
wn.route_options = {
|
wn.route_options = {
|
||||||
"voucher_no": me.frm.doc.name,
|
voucher_no: me.frm.doc.name,
|
||||||
"from_date": me.frm.doc.posting_date,
|
from_date: me.frm.doc.posting_date,
|
||||||
"to_date": me.frm.doc.posting_date,
|
to_date: me.frm.doc.posting_date,
|
||||||
|
company: me.frm.doc.company
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("query-report", "General Ledger");
|
||||||
}, "icon-table");
|
}, "icon-table");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,10 +17,10 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
|
|||||||
parent_field: "parent_item_group",
|
parent_field: "parent_item_group",
|
||||||
formatter: function(item) {
|
formatter: function(item) {
|
||||||
if(!item.is_group) {
|
if(!item.is_group) {
|
||||||
return repl('<a href="#stock-ledger/item_code=%(enc_value)s">%(value)s</a>',
|
return repl("<a \
|
||||||
{
|
onclick='wn.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
|
||||||
|
%(value)s</a>", {
|
||||||
value: item.name,
|
value: item.name,
|
||||||
enc_value: encodeURIComponent(item.name)
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return item.name;
|
return item.name;
|
||||||
@ -183,5 +183,13 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({
|
|||||||
},
|
},
|
||||||
get_plot_points: function(item, col, idx) {
|
get_plot_points: function(item, col, idx) {
|
||||||
return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
|
return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
|
||||||
|
},
|
||||||
|
show_stock_ledger: function(item_code) {
|
||||||
|
wn.route_options = {
|
||||||
|
item_code: item_code,
|
||||||
|
from_date: this.from_date,
|
||||||
|
to_date: this.to_date
|
||||||
|
};
|
||||||
|
wn.set_route("query-report", "Stock Ledger");
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -49,6 +49,7 @@ class DocType(DocListController, WebsiteGenerator):
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
self.validate_name_with_item_group()
|
self.validate_name_with_item_group()
|
||||||
self.update_website()
|
self.update_website()
|
||||||
|
self.update_item_price()
|
||||||
|
|
||||||
def check_warehouse_is_set_for_stock_item(self):
|
def check_warehouse_is_set_for_stock_item(self):
|
||||||
if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
|
if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
|
||||||
@ -210,6 +211,11 @@ class DocType(DocListController, WebsiteGenerator):
|
|||||||
|
|
||||||
WebsiteGenerator.on_update(self)
|
WebsiteGenerator.on_update(self)
|
||||||
|
|
||||||
|
def update_item_price(self):
|
||||||
|
webnotes.conn.sql("""update `tabItem Price` set item_name=%s,
|
||||||
|
item_description=%s, modified=NOW() where item_code=%s""",
|
||||||
|
(self.doc.item_name, self.doc.description, self.doc.name))
|
||||||
|
|
||||||
def get_page_title(self):
|
def get_page_title(self):
|
||||||
if self.doc.name==self.doc.item_name:
|
if self.doc.name==self.doc.item_name:
|
||||||
page_name_from = self.doc.name
|
page_name_from = self.doc.name
|
||||||
|
@ -44,5 +44,5 @@ class DocType(DocListController):
|
|||||||
|
|
||||||
def update_item_price(self):
|
def update_item_price(self):
|
||||||
webnotes.conn.sql("""update `tabItem Price` set currency=%s,
|
webnotes.conn.sql("""update `tabItem Price` set currency=%s,
|
||||||
buying_or_selling=%s where price_list=%s""",
|
buying_or_selling=%s, modified=NOW() where price_list=%s""",
|
||||||
(self.doc.currency, self.doc.buying_or_selling, self.doc.name))
|
(self.doc.currency, self.doc.buying_or_selling, self.doc.name))
|
@ -62,6 +62,9 @@ def get_item_conditions(filters):
|
|||||||
|
|
||||||
def get_sle_conditions(filters):
|
def get_sle_conditions(filters):
|
||||||
conditions = []
|
conditions = []
|
||||||
|
if filters.get("item_code"):
|
||||||
|
conditions.append("""item_code in (select name from tabItem
|
||||||
|
{item_conditions})""".format(item_conditions=get_item_conditions(filters)))
|
||||||
if filters.get("warehouse"):
|
if filters.get("warehouse"):
|
||||||
conditions.append("warehouse=%(warehouse)s")
|
conditions.append("warehouse=%(warehouse)s")
|
||||||
if filters.get("voucher_no"):
|
if filters.get("voucher_no"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user