Fix: Unable to change Employee Cost Center
Fix: Do not add 0 amount Journals to Salary Voucher
This commit is contained in:
parent
09a27e099e
commit
da6997afc6
|
@ -83,7 +83,7 @@ def update(request):
|
||||||
if item.name == '':
|
if item.name == '':
|
||||||
raise ValidationError('Name cannot be blank')
|
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()
|
item.designation = request.json_body.get('Designation', '').strip()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -51,8 +51,9 @@ def salary_journals(start_date, finish_date):
|
||||||
.all()
|
.all()
|
||||||
att = sum(map(lambda x: AttendanceType.by_id(x.attendance_type).value, att))
|
att = sum(map(lambda x: AttendanceType.by_id(x.attendance_type).value, att))
|
||||||
att = round(att * employee.salary / days)
|
att = round(att * employee.salary / days)
|
||||||
amount += att
|
if att != 0:
|
||||||
journals.append(Journal(amount=att, debit=-1, ledger_id=employee.id, cost_center_id=employee.costcenter_id))
|
amount += att
|
||||||
|
journals.append(Journal(amount=att, debit=-1, ledger_id=employee.id, cost_center_id=employee.costcenter_id))
|
||||||
salary = Ledger.salary()
|
salary = Ledger.salary()
|
||||||
salary = Ledger.by_id(uuid.UUID(salary['LedgerID']))
|
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))
|
journals.append(Journal(amount=amount, debit=1, ledger_id=salary.id, cost_center_id=salary.costcenter_id))
|
||||||
|
|
Loading…
Reference in New Issue