Merge pull request #252 from expsa/dev_odex25_mobile

fix is approve overtime
This commit is contained in:
AbuzarExp 2024-07-17 14:58:29 +03:00 committed by GitHub
commit e9cb4b2ad1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 43 additions and 35 deletions

View File

@ -85,21 +85,22 @@ class OverTimeController(http.Controller):
"reason": s.reason,
"reason_msg": s.reason or "",
"overtime_plase":s.overtime_plase,# http_helper.get_lable_selection(s,'overtime_plase',s.overtime_plase),#
# "benefits_discounts_list":s.benefits_discounts.read(['name']),# http_helper.get_lable_selection(s,'overtime_plase',s.overtime_plase),#
}
if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
})
# if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False,
})
li = []
emps =[]
if s.line_ids_over_time:
if approvel:
record = s.line_ids_over_time
else:
record = s.line_ids_over_time.filtered(lambda r:r.employee_id == employee)
# if approvel:
record = s.line_ids_over_time
# else:
# record = s.line_ids_over_time.filtered(lambda r:r.employee_id == employee)
if record:
for r in record:
emps.append({ 'employee_id': r.employee_id.id,
@ -120,8 +121,8 @@ class OverTimeController(http.Controller):
value['employees'] = emps
over.append(value)
next = validator.get_page_pagination_next(page, count)
url = "/rest_api/v2/overtimes?approvel=%s&page=%s" % (approvel, next) if next else False
prev_url = "/rest_api/v2/overtimes?approvel=%s&page=%s" % (approvel, prev) if prev else False
url = "/rest_api/v2/overtimes?page=%s" % (approvel, next) if next else False
prev_url = "/rest_api/v2/overtimes?page=%s" % (approvel, prev) if prev else False
data = {'links': {'prev': prev_url, 'next': url, },
'count': count,
'results': {'overtimes': over,}}
@ -211,6 +212,9 @@ class OverTimeController(http.Controller):
"state": validator.get_state_name(s, s.state),
"reason": s.reason,
"overtime_plase":s.overtime_plase,# http_helper.get_lable_selection(s,'overtime_plase',s.overtime_plase),#
# "benefits_discounts_list":s.benefits_discounts.read(['name']),
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False,
}
li = []
if s.line_ids_over_time:
@ -291,16 +295,16 @@ class OverTimeController(http.Controller):
"overtime_plase":s.overtime_plase,# http_helper.get_lable_selection(s,'overtime_plase',s.overtime_plase),#
}
if approvel:
if s.transfer_type == 'accounting' and 'account' in body and 'journal' in body:
vals.update({
'account_id': body['account'],
'journal_id': body['journal'],
})
elif s.transfer_type == 'payroll' and 'rule' in body :
vals.update({
'benefits_discounts': body['rule'],
})
# if approvel:
if s.transfer_type == 'accounting' and 'account' in body and 'journal' in body:
vals.update({
'account_id': body['account'],
'journal_id': body['journal'],
})
elif s.transfer_type == 'payroll' and 'rule' in body :
vals.update({
'benefits_discounts':int( body['rule']),
})
s.write(vals)
if s.state == 'hr_aaproval':
s.onchange_transfer_type()
@ -317,14 +321,16 @@ class OverTimeController(http.Controller):
"state_name": s.state,
"state": validator.get_state_name(s, s.state),
"reason": s.reason,
# "benefits_discounts":s.benefits_discounts.read(['name']),
}
if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
# if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False,
})
})
li = []
if s.line_ids_over_time:
for r in s.line_ids_over_time:
@ -463,14 +469,16 @@ class OverTimeController(http.Controller):
"state": validator.get_state_name(s, s.state),
"reason": s.reason,
"overtime_plase":s.overtime_plase,# http_helper.get_lable_selection(s,'overtime_plase',s.overtime_plase),#
# "benefits_discounts_list":s.benefits_discounts.read(['name']),
}
if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
# if approvel:
value.update({
'account_id': s.sudo().account_id.name if s.sudo().account_id else False,
'journal_id': s.sudo().journal_id.name if s.sudo().journal_id else False,
'benefits_discounts': s.sudo().benefits_discounts.name if s.sudo().benefits_discounts else False,
'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False,
})
})
li = []
emps =[]
if s.line_ids_over_time: