Merge pull request #34 from nabinhait/master

considered half day lwp in sal slip
This commit is contained in:
Nabin Hait
2011-08-08 02:29:52 -07:00
6 changed files with 216 additions and 204 deletions

View File

@@ -455,7 +455,8 @@
'description': "Don't delete this field at any cost",
'doctype': 'DocField',
'fieldname': 'old_parent',
'fieldtype': 'Data',
'fieldtype': 'Link',
'options': 'Account',
'hidden': 1,
'idx': 24,
'label': 'Old Parent',

View File

@@ -51,7 +51,6 @@ for r in res:
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
if ch:
qur = q1+cond2+cond1+" and t2.name = '%s'"
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))

View File

@@ -52,12 +52,12 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
// to date
// --------
cur_frm.cscript.to_date = function(doc, dt, dn) {
if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){
if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
msgprint("To Date should be same as From Date for Half Day leave");
return;
set_multiple(dt,dn,{to_date:doc.from_date});
}
if(cint(doc.half_day) == 1){
set_multiple(dt,dn,{to_date:doc.from_date});
}
calculate_total_days(doc, dt, dn);
}

View File

@@ -29,7 +29,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
// Calculate total if lwp exists
// ------------------------------------------------------------------------
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay);
doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay);
refresh_field('payment_days');
calculate_all(doc, dt, dn);
}

View File

@@ -101,8 +101,17 @@ class DocType(TransactionBase):
for d in range(m[3]):
dt = add_days(cstr(m[1]), d)
if dt not in holidays:
if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)):
lwp += 1
leave = sql("""
select t1.name, t1.half_day
from `tabLeave Application` t1, `tabLeave Type` t2
where t2.name = t1.leave_type
and ifnull(t2.is_lwp, 0) = 1
and t1.docstatus = 1
and t1.employee = '%s'
and '%s' between from_date and to_date
"""%(self.doc.employee, dt))
if leave:
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
return lwp
# Check existing

View File

@@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 334
last_patch = 335
#-------------------------------------------
@@ -1352,3 +1352,6 @@ def execute(patch_no):
p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1)
elif patch_no == 334:
reload_doc('knowledge_base', 'doctype', 'answer')
elif patch_no == 335:
for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']:
sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt))