Fixed minor errors in SalaryDeduction

This commit is contained in:
Tanshu 2012-11-28 16:11:00 +05:30
parent 73b5520c4c
commit 38b7f941d5
3 changed files with 5 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class VoucherType:
list.append(VoucherType(9, 'Verification'))
list.append(VoucherType(10, 'Opening Balance'))
list.append(VoucherType(11, 'Closing Balance'))
list.append(VoucherType(12, 'Salary Deductions'))
list.append(VoucherType(12, 'Salary Deduction'))
return list
@classmethod

View File

@ -137,6 +137,7 @@ def voucher_info(voucher):
'Narration': voucher.narration,
'Journals': [],
'Inventories': [],
'SalaryDeductions': [],
'CreationDate': voucher.creation_date.strftime('%d-%b-%Y %H:%M'),
'LastEditDate': voucher.last_edit_date.strftime('%d-%b-%Y %H:%M'),
'User': {'UserID': voucher.user.id, 'Name': voucher.user.name},
@ -148,7 +149,6 @@ def voucher_info(voucher):
'Ledger': {'LedgerID': item.ledger.id, 'Name': item.ledger.name},
'CostCenter': {'CostCenterID': item.cost_center_id}})
for item in voucher.salary_deductions:
json_voucher['SalaryDeductions'] = []
json_voucher['SalaryDeductions'].append(
{'GrossSalary': item.gross_salary,
'DaysWorked': item.days_worked,
@ -236,6 +236,8 @@ def get_edit_url(request, voucher):
return request.route_url('payment_id', id=voucher.id)
elif voucher.type == 5:
return request.route_url('receipt_id', id=voucher.id)
elif voucher.type == 12:
return request.route_url('salary_deduction_id', id=voucher.id)
else:
return '#'

View File

@ -36,7 +36,7 @@ def salary_deduction_create_voucher(json, user):
def salary_deduction_update_voucher(voucher, json, user):
dt = get_last_day(datetime.datetime.strptime(json['Date'], '%d-%b-%Y'))
if dt != voucher.date:
if dt != voucher.date.date():
raise ValidationError("Date Cannot be changed for Salary Deduction voucher!")
days_in_month = voucher.date.day
voucher.user_id = user.id