From 5163687b4b63b103aab96005c7da63cee635e042 Mon Sep 17 00:00:00 2001 From: odex Date: Wed, 17 Jul 2024 14:43:07 +0300 Subject: [PATCH 1/2] fix is approve overtime --- .../controllers/rest_api_v2/overtime.py | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py index 64a387697..488e0a2c9 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py @@ -86,20 +86,20 @@ class OverTimeController(http.Controller): "reason_msg": s.reason or "", "overtime_plase":s.overtime_plase,# 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, - }) + }) 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 +120,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,}} @@ -291,16 +291,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': body['rule'], + }) s.write(vals) if s.state == 'hr_aaproval': s.onchange_transfer_type() @@ -318,13 +318,13 @@ class OverTimeController(http.Controller): "state": validator.get_state_name(s, s.state), "reason": s.reason, } - 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, - }) + }) li = [] if s.line_ids_over_time: for r in s.line_ids_over_time: @@ -464,13 +464,13 @@ class OverTimeController(http.Controller): "reason": s.reason, "overtime_plase":s.overtime_plase,# 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, - }) + }) li = [] emps =[] if s.line_ids_over_time: From 7998eb2e18b16457474cd1f3a71c5d1988448174 Mon Sep 17 00:00:00 2001 From: odex Date: Wed, 17 Jul 2024 14:57:01 +0300 Subject: [PATCH 2/2] fix is approve overtime --- .../odex_mobile/controllers/rest_api_v2/overtime.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py b/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py index 488e0a2c9..5e4a9e9a5 100644 --- a/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py +++ b/odex25_mobile/odex_mobile/controllers/rest_api_v2/overtime.py @@ -85,13 +85,14 @@ 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, - + 'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False, }) li = [] emps =[] @@ -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: @@ -299,7 +303,7 @@ class OverTimeController(http.Controller): }) elif s.transfer_type == 'payroll' and 'rule' in body : vals.update({ - 'benefits_discounts': body['rule'], + 'benefits_discounts':int( body['rule']), }) s.write(vals) if s.state == 'hr_aaproval': @@ -317,12 +321,14 @@ 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, + 'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False, }) li = [] @@ -463,12 +469,14 @@ 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, + 'benefits_discounts_id': s.sudo().benefits_discounts.id if s.sudo().benefits_discounts else False, }) li = []