From a0f7bd26f8ebf01ae4b0dee2cd8bc2da59c40950 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 12 Nov 2012 14:57:12 +0530 Subject: [PATCH] jv filter for against_jv, freeze fix, added show ledger in account --- accounts/doctype/account/account.js | 14 ++++++-------- .../journal_voucher/journal_voucher.js | 19 +++++++++++++++++++ .../journal_voucher/journal_voucher.py | 6 +++--- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index 2d35bd136f7..59ed4526459 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -20,13 +20,6 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } -cur_frm.cscript.set_breadcrumbs = function(barea) { - cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname); - cur_frm.frm_head.appframe.add_breadcrumb(' in \ - Chart of Accounts'); - cur_frm.frm_head.appframe.add_breadcrumb(' in Accounts'); -} - // Refresh // ----------------------------------------- cur_frm.cscript.refresh = function(doc, cdt, cdn) { @@ -55,7 +48,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.account_type(doc, cdt, cdn); // show / hide convert buttons - cur_frm.cscript.hide_unhide_group_ledger(doc); + cur_frm.cscript.hide_unhide_group_ledger(doc); } } @@ -90,6 +83,11 @@ cur_frm.cscript.hide_unhide_group_ledger = function(doc) { } else if (cstr(doc.group_or_ledger) == 'Ledger') { cur_frm.add_custom_button('Convert to Group', function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet') + + cur_frm.add_custom_button('View Ledger', function() { + wn.set_route('Report', 'GL Entry', 'General Ledger', + 'Account=' + doc.name); + }); } } // Convert group to ledger diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js index d60dba6d1e8..410643d249e 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.js +++ b/accounts/doctype/journal_voucher/journal_voucher.js @@ -74,6 +74,25 @@ cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = fun return "SELECT `tabSales Invoice`.name, `tabSales Invoice`.debit_to, `tabSales Invoice`.outstanding_amount FROM `tabSales Invoice` WHERE `tabSales Invoice`.debit_to='"+d.account+"' AND `tabSales Invoice`.outstanding_amount > 0 AND `tabSales Invoice`.docstatus = 1 AND `tabSales Invoice`.%(key)s LIKE '%s' ORDER BY `tabSales Invoice`.name DESC LIMIT 200"; } +cur_frm.fields_dict['entries'].grid.get_field('against_jv').get_query = function(doc) { + var d = locals[this.doctype][this.docname]; + + if(!d.account) { + msgprint("Please select Account first!") + throw "account not selected" + } + + return "SELECT `tabJournal Voucher`.name, `tabJournal Voucher`.posting_date,\ + `tabJournal Voucher`.user_remark\ + from `tabJournal Voucher`, `tabJournal Voucher Detail`\ + where `tabJournal Voucher Detail`.account = '"+ esc_quotes(d.account) + "'\ + and `tabJournal Voucher`.name like '%s'\ + and `tabJournal Voucher`.docstatus=1\ + and `tabJournal Voucher`.voucher_type='Journal Entry'\ + and `tabJournal Voucher Detail`.parent = `tabJournal Voucher`.name"; +} + + // TDS Account Head cur_frm.fields_dict['tax_code'].get_query = function(doc) { return "SELECT `tabTDS Category Account`.account_head FROM `tabTDS Category Account` WHERE `tabTDS Category Account`.parent = '"+doc.tds_category+"' AND `tabTDS Category Account`.company='"+doc.company+"' AND `tabTDS Category Account`.account_head LIKE '%s' ORDER BY `tabTDS Category Account`.account_head DESC LIMIT 50"; diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py index c750fc3f90a..d6dcdf25ed2 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.py +++ b/accounts/doctype/journal_voucher/journal_voucher.py @@ -149,16 +149,16 @@ class DocType: def validate_cheque_info(self): if self.doc.voucher_type in ['Bank Voucher']: if not self.doc.cheque_no or not self.doc.cheque_date: - msgprint("Cheque No & Cheque Date is required for " + cstr(self.doc.voucher_type)) + msgprint("Reference No & Reference Date is required for " + cstr(self.doc.voucher_type)) raise Exception if self.doc.cheque_date and not self.doc.cheque_no: - msgprint("Cheque No is mandatory if you entered Cheque Date") + msgprint("Reference No is mandatory if you entered Reference Date") raise Exception def validate_entries_for_advance(self): for d in getlist(self.doclist,'entries'): - if not d.is_advance and not d.against_voucher and not d.against_invoice and d.against_jv: + if not d.is_advance and not d.against_voucher and not d.against_invoice and not d.against_jv: master_type = self.get_master_type(d.account) if (master_type == 'Customer' and flt(d.credit) > 0) or (master_type == 'Supplier' and flt(d.debit) > 0): msgprint("Message: Please check Is Advance as 'Yes' against Account %s if this is an advance entry." % d.account)