Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-11-23 12:31:54 +01:00
commit 4c90b3fc7e
2 changed files with 14 additions and 6 deletions

View File

@ -206,7 +206,7 @@ def get_data(rows, company_abbr):
if accounts:
total_debit = total_credit = 0
for acc_idx in xrange(len(accounts)):
col_idx = len(columns) - 1 + acc_idx
col_idx = len(columns) + acc_idx
if flt(r[col_idx]) != 0:
if not acc_dict.get(accounts[acc_idx]):
acc_dict[accounts[acc_idx]] = 0
@ -215,7 +215,7 @@ def get_data(rows, company_abbr):
total_debit += flt(r[col_idx])
else:
total_credit += abs(flt(r[col_idx]))
d['total_debit'] = total_debit
d['total_credit'] = total_credit
@ -227,5 +227,9 @@ def get_data(rows, company_abbr):
columns = [c.replace(" ", "_").lower() for c in rows[i+1]
if not c.endswith(" - " + company_abbr)]
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
raise Exception, """A non-account column cannot be after an account \
column. Please rectify it in the file and try again."""
return data, start_row_idx

View File

@ -29,6 +29,8 @@ cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) {
if(callback) {
callback(doc, cdt, cdn);
}
} else if(doc.charge) {
cur_frm.cscript.get_charges(doc, cdt, cdn, callback);
} else {
$c_obj(make_doclist(doc.doctype, doc.name),'load_default_taxes','',function(r,rt){
refresh_field('other_charges');
@ -374,12 +376,14 @@ cur_frm.fields_dict.charge.get_query = function(doc) {
}
// ********************* Get Charges ****************************
cur_frm.cscript.get_charges = function(doc, cdt, cdn) {
cur_frm.cscript.get_charges = function(doc, cdt, cdn, callback) {
$c_obj(make_doclist(doc.doctype,doc.name),
'get_other_charges',
'',
function(r, rt) { cur_frm.cscript.calculate_charges(doc, cdt, cdn);}
,null,null,cur_frm.fields_dict.get_charges.input);
function(r, rt) {
cur_frm.cscript.calculate_charges(doc, cdt, cdn);
if(callback) callback(doc, cdt, cdn);
}, null,null,cur_frm.fields_dict.get_charges.input);
}