Merge pull request #1141 from nabinhait/hotfix
[fix] [minor] Master name validation for customer/supplier/warehouse acc...
This commit is contained in:
commit
80d9514636
@ -38,9 +38,12 @@ class DocType:
|
||||
|
||||
def validate_master_name(self):
|
||||
"""Remind to add master name"""
|
||||
if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') \
|
||||
and not self.doc.master_name:
|
||||
msgprint("Message: Please enter Master Name once the account is created.")
|
||||
if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse":
|
||||
if not self.doc.master_name:
|
||||
msgprint(_("Please enter Master Name once the account is created."))
|
||||
elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type,
|
||||
self.doc.master_name):
|
||||
webnotes.throw(_("Invalid Master Name"))
|
||||
|
||||
def validate_parent(self):
|
||||
"""Fetch Parent Details and validation for account not to be created under ledger"""
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user