[fix] [minor] make bank voucher from salary manager

This commit is contained in:
Nabin Hait 2013-12-04 15:17:46 +05:30
parent 40580d5d01
commit c2da052c80
2 changed files with 15 additions and 31 deletions

View File

@ -18,10 +18,6 @@ cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
return $c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
}
//Submit salary slip
//-----------------------
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
var check = confirm(wn._("Do you really want to Submit all Salary Slip for month : ") + doc.month+ wn._(" and fiscal year : ")+doc.fiscal_year);
if(check){
@ -33,23 +29,21 @@ cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
}
}
// Make Bank Voucher
//-----------------------
cur_frm.cscript.make_bank_voucher = function(doc,cdt,cdn){
if(doc.month && doc.fiscal_year){
cur_frm.cscript.make_jv(doc, cdt, cdn);
}
if(doc.company && doc.month && doc.fiscal_year){
cur_frm.cscript.make_jv(doc, cdt, cdn);
} else {
msgprint(wn._("Company, Month and Fiscal Year is mandatory"));
}
}
// Make JV
//-----------------------
cur_frm.cscript.make_jv = function(doc, dt, dn) {
var call_back = function(r,rt){
var call_back = function(r, rt){
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
jv = locals['Journal Voucher'][jv];
jv.voucher_type = 'Bank Voucher';
jv.user_remark = wn._('Payment of salary for the month: ') + doc.month + wn._('and fiscal year: ') + doc.fiscal_year;
jv.user_remark = wn._('Payment of salary for the month: ') + doc.month +
wn._('and fiscal year: ') + doc.fiscal_year;
jv.fiscal_year = doc.fiscal_year;
jv.company = doc.company;
jv.posting_date = dateutil.obj_to_str(new Date());
@ -61,10 +55,9 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
// debit to salary account
var d2 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
d2.account = r.message['default_salary_account'];
d2.debit = r.message['amount']
loaddoc('Journal Voucher', jv.name);
}
return $c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
return $c_obj(make_doclist(dt, dn), 'get_acc_details', '', call_back);
}

View File

@ -3,17 +3,10 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, flt
from webnotes.model import db_exists
from webnotes.model.doc import Document
from webnotes.model.bean import getlist, copy_doclist
from webnotes.model.code import get_obj
from webnotes import msgprint
class DocType:
def __init__(self, doc, doclist):
self.doc = doc
@ -198,14 +191,12 @@ class DocType:
get default bank account,default salary acount from company
"""
amt = self.get_total_salary()
com = webnotes.conn.sql("select default_bank_account from `tabCompany` where name = '%s'" % self.doc.company)
if not com[0][0] or not com[0][1]:
default_bank_account = webnotes.conn.get_value("Company", self.doc.company,
"default_bank_account")
if not default_bank_account:
msgprint("You can set Default Bank Account in Company master.")
ret = {
'def_bank_acc' : com and com[0][0] or '',
'def_sal_acc' : com and com[0][1] or '',
return {
'default_bank_account' : default_bank_account,
'amount' : amt
}
return ret
}