jv filter for against_jv, freeze fix, added show ledger in account

This commit is contained in:
Rushabh Mehta 2012-11-12 14:57:12 +05:30
parent d1784cca00
commit a0f7bd26f8
3 changed files with 28 additions and 11 deletions

View File

@ -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 <a href="#!Accounts Browser/Account">\
Chart of Accounts</a>');
cur_frm.frm_head.appframe.add_breadcrumb(' in <a href="#!accounts-home">Accounts</a>');
}
// 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

View File

@ -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";

View File

@ -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)