[enhancement] [minor] stock ledger, general ledger buttons in warehouse
This commit is contained in:
parent
79a6fc9a84
commit
3cc9b3ef08
@ -1,9 +1,25 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.cscript.refresh = function(doc) {
|
||||
cur_frm.toggle_display('warehouse_name', doc.__islocal);
|
||||
}
|
||||
frappe.ui.form.on("Warehouse", {
|
||||
refresh: function(frm) {
|
||||
frm.toggle_display('warehouse_name', frm.doc.__islocal);
|
||||
|
||||
frm.add_custom_button(__("Stock Ledger"), function() {
|
||||
frappe.set_route("query-report", "Stock Ledger", {"warehouse": frm.doc.name});
|
||||
});
|
||||
if(frm.doc.__onload && frm.doc.__onload.account) {
|
||||
frm.add_custom_button(__("General Ledger"), function() {
|
||||
frappe.route_options = {
|
||||
"account": frm.doc.__onload.account,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cur_frm.set_query("create_account_under", function() {
|
||||
return {
|
||||
|
@ -14,6 +14,14 @@ class Warehouse(Document):
|
||||
if not self.warehouse_name.endswith(suffix):
|
||||
self.name = self.warehouse_name + suffix
|
||||
|
||||
def onload(self):
|
||||
'''load account name for General Ledger Report'''
|
||||
account = frappe.db.get_value("Account", {
|
||||
"account_type": "Warehouse", "company": self.company, "warehouse": self.name})
|
||||
|
||||
if account:
|
||||
self.set_onload('account', account)
|
||||
|
||||
def validate(self):
|
||||
if self.email_id:
|
||||
validate_email_add(self.email_id, True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user