Fix: Unable to change Employee Cost Center

Fix: Do not add 0 amount Journals to Salary Voucher
This commit is contained in:
Amritanshu 2014-08-12 13:17:41 +05:30
parent 09a27e099e
commit da6997afc6
2 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ def update(request):
if item.name == '':
raise ValidationError('Name cannot be blank')
item.cost_center_id = uuid.UUID(request.json_body['CostCenter']['CostCenterID'])
item.costcenter_id = uuid.UUID(request.json_body['CostCenter']['CostCenterID'])
item.designation = request.json_body.get('Designation', '').strip()
try:

View File

@ -51,8 +51,9 @@ def salary_journals(start_date, finish_date):
.all()
att = sum(map(lambda x: AttendanceType.by_id(x.attendance_type).value, att))
att = round(att * employee.salary / days)
amount += att
journals.append(Journal(amount=att, debit=-1, ledger_id=employee.id, cost_center_id=employee.costcenter_id))
if att != 0:
amount += att
journals.append(Journal(amount=att, debit=-1, ledger_id=employee.id, cost_center_id=employee.costcenter_id))
salary = Ledger.salary()
salary = Ledger.by_id(uuid.UUID(salary['LedgerID']))
journals.append(Journal(amount=amount, debit=1, ledger_id=salary.id, cost_center_id=salary.costcenter_id))