Skip to content

Commit

Permalink
Análisis del submódulo de Asistencia, Vacaciones y Rendimiento de gas…
Browse files Browse the repository at this point in the history
…tos (#780) (#788)

* trans: translations

* feat: dominio HR Asistencia, Vacaciones y Rendimiento de Gastos

* feat: desocultamiento

* feat: solicitud de viaje

* trans: leave application

* trans;

* trans

* fix: Earned Leave allocation from Leave Policy Assignment

* trans

* trans

* trans

* trans

* Issue 560 refactor employee leave balance (#787)

* refactor: Employee Leave Balance Report

- incorrect opening balance on boundary allocation dates

- carry forwarded leaves accounted in leaves allocated column, should be part of opening balance

- leaves allocated column also adds expired leave allocations causing negative balances, should only consider non-expiry records

(cherry picked from commit 538b64b)

* fix: expired leaves not calculated properly because of newly created expiry ledger entries

(cherry picked from commit 1ea749c)

* refactor: Leaves Taken calculation

- fix issue where Leaves Taken also adds leaves expiring on boundary date as leaves taken, causing ambiguity

- remove unnecessary `skip_expiry_leaves` function

- `get_allocation_expiry` considering cancelled entries too

(cherry picked from commit 26b40e7)

* refactor: balance in Balance Summary report near allocation expiry date

- Leave Balance shows minimum leaves remaining after comparing with remaining days for allocation expiry causing ambiguity

- refactor remaining leaves calculation to return both, actual leave balance and balance for consumption

- show actual balance in leave application, use balance for consumption only in validations

(cherry picked from commit 55ac851)

* fix: sort imports, sider issues

(cherry picked from commit b5c686a)

* fix: show actual balance instead of consumption balance in opening balance

- not changing opening balance based on remaining days

(cherry picked from commit dbfa463)

* test: employee leave balance report

- fix expired leaves calculation when filters span across 2 different allocation periods

(cherry picked from commit c050ce4)

* chore: remove unused imports, sort imports, fix sider

(cherry picked from commit c7d5949)

* test: Employee Leave Balance Summary

(cherry picked from commit 88141d6)

* fix: leave application dashboard

- total leaves allocated considering cancelled leaves

- optional plural for leave category labels

- show dashboard only once from date is set, else it fetches all allocations till date and generates incorrect balance

- change pending leaves to 'Leaves Pending Approval' for better context

- update labels in Salary Slip Leave Details table

(cherry picked from commit 942511c)

* fix: earned leave policy assignment test

(cherry picked from commit aaa1ae9)

* test: fix test `test_leave_balance_near_allocaton_expiry`

(cherry picked from commit a58dfec)

* test: get leave details for leave application dashboard

(cherry picked from commit 3f3b176)

* fix: add type hints for employee leave balance report

(cherry picked from commit 430bf00)

* feat: split ledger entries for applications created across allocations

- fix: ledger entry for expiring cf leaves not considering holidays

(cherry picked from commit c0f1e26)

* fix: clearer validation/warning messages for insufficient balance in leave application

(cherry picked from commit a504ffc)

* test: leave application validations

(cherry picked from commit 6755d6e)

* fix: boundary determination for separate ledger entries

(cherry picked from commit 7023915)

* test: separate leave ledger entries for leave applications across allocations

(cherry picked from commit 97b7b50)

* chore: linter issue

(cherry picked from commit 921d6b2)

---------



---------

Co-authored-by: Rucha Mahabal <[email protected]>
  • Loading branch information
fproldan and ruchamahabal authored Aug 29, 2023
1 parent 53f5f84 commit 1298de1
Show file tree
Hide file tree
Showing 62 changed files with 1,321 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

data = {
'modules': [
'HR Asistencia y Vacaciones'
'HR Asistencia, Vacaciones y Rendimiento de Gastos'
],
}
7 changes: 0 additions & 7 deletions erpnext/domains/hr_reclutamiento_capacitacion_gastos.py

This file was deleted.

5 changes: 2 additions & 3 deletions erpnext/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@
'RMA': 'erpnext.domains.rma',
'Retail Avanzado': 'erpnext.domains.retail_avanzado',
'Servicios Google': 'erpnext.domains.servicios_google',
'HR Asistencia y Vacaciones': 'erpnext.domains.hr_asistencia_vacaciones',
'HR Reclutamiento, Capacitacion y Gastos': 'erpnext.domains.hr_reclutamiento_capacitacion_gastos',
'Build': 'erpnext.domains.build',
'Pagos360': 'erpnext.domains.pagos360',
'Mercadolibre': 'erpnext.domains.mercadolibre',
Expand All @@ -128,7 +126,8 @@
'Compreahora': 'erpnext.domains.compreahora',
'Usuario de Ventas Reducido': 'erpnext.domains.usuario_ventas_reducido',
'Usuario de Soporte Reducido': 'erpnext.domains.usuario_soporte_reducido',
'Usuario de Proyecto Reducido':'erpnext.domains.usuario_proyecto_reducido',
'Usuario de Proyecto Reducido': 'erpnext.domains.usuario_proyecto_reducido',
'HR Asistencia, Vacaciones y Rendimiento de Gastos': 'erpnext.domains.hr_asistencia_vacaciones_rendimiento_gastos',
}

website_generators = ["Item Group", "Website Item", "BOM", "Sales Partner",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/appraisal/appraisal.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-05-12 20:01:58.902166",
"modified": "2021-05-12 21:01:58.902166",
"modified_by": "Administrator",
"module": "HR",
"name": "Appraisal",
Expand Down Expand Up @@ -246,7 +246,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Reclutamiento, Capacitacion y Gastos",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"search_fields": "status, employee, employee_name",
"sort_field": "modified",
"sort_order": "DESC",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/appraisal_template/appraisal_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"icon": "icon-file-text",
"idx": 1,
"links": [],
"modified": "2021-05-12 20:01:59.271381",
"modified": "2021-05-12 21:01:59.271381",
"modified_by": "Administrator",
"module": "HR",
"name": "Appraisal Template",
Expand All @@ -67,7 +67,7 @@
"role": "Employee"
}
],
"restrict_to_domain": "HR Reclutamiento, Capacitacion y Gastos",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "DESC"
}
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/attendance/attendance.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"idx": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-05-12 20:01:54.473452",
"modified": "2021-05-12 21:01:54.473452",
"modified_by": "Administrator",
"module": "HR",
"name": "Attendance",
Expand Down Expand Up @@ -253,7 +253,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"search_fields": "employee,employee_name,attendance_date,status",
"sort_field": "modified",
"sort_order": "DESC",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/attendance_request/attendance_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2021-05-12 20:01:54.807226",
"modified": "2021-05-12 21:01:54.807226",
"modified_by": "Administrator",
"module": "HR",
"name": "Attendance Request",
Expand Down Expand Up @@ -183,7 +183,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "employee_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
],
"is_submittable": 1,
"links": [],
"modified": "2021-05-12 20:01:53.391272",
"modified": "2021-05-12 21:01:53.391272",
"modified_by": "Administrator",
"module": "HR",
"name": "Compensatory Leave Request",
Expand Down Expand Up @@ -172,7 +172,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "employee_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}
],
"links": [],
"modified": "2021-05-12 20:01:56.379840",
"modified": "2021-05-12 21:01:56.379840",
"modified_by": "Administrator",
"module": "HR",
"name": "Daily Work Summary Group",
Expand All @@ -85,7 +85,7 @@
}
],
"quick_entry": 1,
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "DESC"
}
3 changes: 1 addition & 2 deletions erpnext/hr/doctype/department/department.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"description": "Days for which Holidays are blocked for this department.",
"fieldname": "leave_block_list",
"fieldtype": "Link",
"hidden": 1,
"in_list_view": 1,
"label": "Leave Block List",
"options": "Leave Block List"
Expand Down Expand Up @@ -145,7 +144,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2023-01-09 15:57:33.875494",
"modified": "2023-07-31 12:58:08.462456",
"modified_by": "Administrator",
"module": "HR",
"name": "Department",
Expand Down
11 changes: 6 additions & 5 deletions erpnext/hr/doctype/department_approver/department_approver.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):

if filters.get("doctype") == "Leave Application":
parentfield = "leave_approvers"
field_name = "Leave Approver"
field_name = _("Leave Approver")
elif filters.get("doctype") == "Expense Claim":
parentfield = "expense_approvers"
field_name = "Expense Approver"
field_name = _("Expense Approver")
elif filters.get("doctype") == "Shift Request":
parentfield = "shift_request_approver"
field_name = "Shift Request Approver"
field_name = _("Shift Request Approver")
if department_list:
for d in department_list:
approvers += frappe.db.sql("""select user.name, user.first_name, user.last_name from
Expand All @@ -63,7 +63,8 @@ def get_approvers(doctype, txt, searchfield, start, page_len, filters):
if len(approvers) == 0:
error_msg = _("Please set {0} for the Employee: {1}").format(field_name, frappe.bold(employee.employee_name))
if department_list:
error_msg += _(" or for Department: {0}").format(frappe.bold(employee_department))
frappe.throw(error_msg, title=_(field_name + " Missing"))
error_msg += " " + _("or for Department: {0}").format(frappe.bold(employee_department))
frappe.throw(error_msg, title=_("{0} Missing").format(field_name))


return set(tuple(approver) for approver in approvers)
3 changes: 1 addition & 2 deletions erpnext/hr/doctype/employee/employee.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@
"collapsible": 1,
"fieldname": "attendance_and_leave_details",
"fieldtype": "Section Break",
"hidden": 1,
"label": "Attendance and Leave Details"
},
{
Expand Down Expand Up @@ -829,7 +828,7 @@
"idx": 24,
"image_field": "image",
"links": [],
"modified": "2022-08-11 15:28:59.782180",
"modified": "2023-07-31 12:56:37.591515",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",
Expand Down
14 changes: 11 additions & 3 deletions erpnext/hr/doctype/employee_advance/employee_advance.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"amended_from",
"column_break_18",
"advance_account",
"mode_of_payment"
"mode_of_payment",
"travel_request"
],
"fields": [
{
Expand Down Expand Up @@ -196,11 +197,18 @@
"precision": "9",
"print_hide": 1,
"reqd": 1
},
{
"fieldname": "travel_request",
"fieldtype": "Link",
"label": "Travel Request",
"options": "Travel Request",
"read_only": 1
}
],
"is_submittable": 1,
"links": [],
"modified": "2021-09-11 18:38:38.617478",
"modified": "2023-08-01 08:07:59.242651",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Advance",
Expand Down Expand Up @@ -233,7 +241,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Reclutamiento, Capacitacion y Gastos",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"search_fields": "employee,employee_name",
"sort_field": "modified",
"sort_order": "DESC",
Expand Down
4 changes: 4 additions & 0 deletions erpnext/hr/doctype/employee_advance/employee_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def validate(self):
validate_active_employee(self.employee)
self.set_status()

def on_submit(self):
if self.travel_request:
frappe.db.set_value('Travel Request', self.travel_request, 'employee_advance', self.name)

def on_cancel(self):
self.ignore_linked_doctypes = ('GL Entry')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ def get_data():
'fieldname': 'employee_advance',
'non_standard_fieldnames': {
'Payment Entry': 'reference_name',
'Journal Entry': 'reference_name'
'Journal Entry': 'reference_name',
},
'transactions': [
{
'items': ['Expense Claim']
},
{
'items': ['Payment Entry', 'Journal Entry']
'items': ['Payment Entry', 'Journal Entry', 'Travel Request']
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"hide_toolbar": 1,
"issingle": 1,
"links": [],
"modified": "2021-05-12 20:01:54.184685",
"modified": "2021-05-12 21:01:54.184685",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Attendance Tool",
Expand All @@ -84,7 +84,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "DESC"
}
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/employee_checkin/employee_checkin.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
}
],
"links": [],
"modified": "2021-05-12 20:01:55.298451",
"modified": "2021-05-12 21:01:55.298451",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee Checkin",
Expand Down Expand Up @@ -201,7 +201,7 @@
"role": "Employee"
}
],
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"sort_field": "modified",
"sort_order": "ASC",
"title_field": "employee_name",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/expense_claim/expense_claim.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@
"idx": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-11-22 16:26:57.787838",
"modified": "2021-11-23 16:26:57.787838",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim",
Expand Down Expand Up @@ -441,7 +441,7 @@
"write": 1
}
],
"restrict_to_domain": "HR Reclutamiento, Capacitacion y Gastos",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"search_fields": "employee,employee_name",
"show_name_in_global_search": 1,
"sort_field": "modified",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"fieldname": "account_head",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Account Head",
"label": "Cuenta contable",
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
Expand Down Expand Up @@ -61,7 +61,7 @@
"fieldname": "rate",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Rate",
"label": "Al\u00edcuota",
"oldfieldname": "rate",
"oldfieldtype": "Currency"
},
Expand Down Expand Up @@ -102,7 +102,7 @@
],
"istable": 1,
"links": [],
"modified": "2021-05-12 19:59:12.974975",
"modified": "2023-08-01 11:13:52.620713",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Taxes and Charges",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/holiday_list/holiday_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
"icon": "fa fa-calendar",
"idx": 1,
"links": [],
"modified": "2022-06-22 15:13:55.735097",
"modified": "2022-06-22 16:13:55.735097",
"modified_by": "Administrator",
"module": "HR",
"restrict_to_domain": "HR Asistencia y Vacaciones",
"restrict_to_domain": "HR Asistencia, Vacaciones y Rendimiento de Gastos",
"name": "Holiday List",
"owner": "Administrator",
"permissions": [
Expand Down
Loading

0 comments on commit 1298de1

Please sign in to comment.