[hot] [fix] journal entry

This commit is contained in:
Rushabh Mehta 2015-04-16 15:35:49 +05:30
parent d839a730cf
commit acf489c5ef

View File

@ -138,6 +138,8 @@ cur_frm.script_manager.make(erpnext.accounts.JournalVoucher);
cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.refresh = function(doc) {
cur_frm.cscript.is_opening(doc) cur_frm.cscript.is_opening(doc)
erpnext.toggle_naming_series(); erpnext.toggle_naming_series();
cur_frm.cscript.voucher_type();
if(doc.docstatus==1) { if(doc.docstatus==1) {
cur_frm.add_custom_button(__('View Ledger'), function() { cur_frm.add_custom_button(__('View Ledger'), function() {
frappe.route_options = { frappe.route_options = {
@ -235,8 +237,8 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
refresh_field("accounts"); refresh_field("accounts");
} }
if(!(doc.accounts || []).length) {
if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) { if(in_list(["Bank Entry", "Cash Entry"], doc.voucher_type)) {
cur_frm.clear_table("accounts");
return frappe.call({ return frappe.call({
type: "GET", type: "GET",
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_default_bank_cash_account", method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_default_bank_cash_account",
@ -251,7 +253,6 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
} }
}) })
} else if(doc.voucher_type=="Opening Entry") { } else if(doc.voucher_type=="Opening Entry") {
cur_frm.clear_table("accounts");
return frappe.call({ return frappe.call({
type:"GET", type:"GET",
method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_opening_accounts", method: "erpnext.accounts.doctype.journal_entry.journal_entry.get_opening_accounts",
@ -268,6 +269,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
}) })
} }
} }
}
frappe.ui.form.on("Journal Entry Account", "party", function(frm, cdt, cdn) { frappe.ui.form.on("Journal Entry Account", "party", function(frm, cdt, cdn) {
var d = frappe.get_doc(cdt, cdn); var d = frappe.get_doc(cdt, cdn);