Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v15 beta #811

Merged
merged 85 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
acfcb6a
feat: create Shift Attendance Report
krantheman Aug 4, 2023
b6cf1bc
feat(Shift Attendance): add filters
krantheman Aug 7, 2023
93e42b1
feat(Shift Attendance): add color coding for Late Entry and Early Exit
krantheman Aug 7, 2023
318c59b
chore(Shift Attendance): convert spaces into tabs
krantheman Aug 8, 2023
9f4b4a6
fix(Shift Attendance): use system precision for working hours
krantheman Aug 8, 2023
c1d1a40
fix(Shift Assignment): cint not imported
krantheman Aug 8, 2023
eb503e2
fix(Shift Assignment): display of cancelled records
krantheman Aug 8, 2023
b8bed21
fix(Shift Attendance): unadjusted column widths and redundant Employe…
krantheman Aug 8, 2023
b21ac25
feat(Shift Assignment): show date along with time if In Time and Out …
krantheman Aug 8, 2023
4257a37
feat(Shift Assignment): add color coding for Early Entry/Late Exit
krantheman Aug 8, 2023
0f4be64
feat(Shift Assignment): update filters
krantheman Aug 8, 2023
7683805
feat(Shift Assignment): add Attendance Status column
krantheman Aug 8, 2023
734af7f
fix(Shift Attendance): error thrown by records with only In/Out Time
krantheman Aug 8, 2023
3492c44
feat(Shift Assignment): add Chart and Report Summary
krantheman Aug 8, 2023
44c2327
chore(Shift Attendance): fix typo
krantheman Aug 8, 2023
e101404
test(Shift Attendance): add basic tests
krantheman Aug 10, 2023
056e870
test(Shift Attendance): saner datetime logic
krantheman Aug 10, 2023
3df241c
revert: "feat(Shift Assignment): add color coding for Early Entry/Lat…
krantheman Aug 10, 2023
9630ed7
refactor(Shift Assignment): change chart type to percentage
krantheman Aug 10, 2023
c7299e3
feat(Shift Assignment): add Late Entry By and Early Exit By
krantheman Aug 11, 2023
5eb7213
feat(Shift Assignment): add Consider Grace Period filter
krantheman Aug 11, 2023
3526cdd
feat(Shift Assignment): add flagging of late entries/early exits when…
krantheman Aug 11, 2023
6da4d8e
fix(Shift Assignment): add Late Entry/Early Exit filter for while not…
krantheman Aug 11, 2023
ed9f75a
fix(Payroll JE): link employee in advance return entries
ruchamahabal Aug 15, 2023
f652f7e
fix: link advance against deduction JV + minor refactor
ruchamahabal Aug 17, 2023
e6d9805
fix(Shift Type): rename misleading Enable Entry/Exit Grace Period che…
krantheman Aug 17, 2023
7090b9b
fix: Allow float for `Maximum Leave Allocation Allowed` (#789)
niraj2477 Aug 17, 2023
30081ff
chore: fix employee name visibility & adjust col widths
ruchamahabal Aug 17, 2023
2498007
fix: move shift start & end time columns to the start
ruchamahabal Aug 17, 2023
abff88e
chore(formatting): separate logically related blocks by blank lines
ruchamahabal Aug 17, 2023
1c64e2d
fix: respect system datetime format for shift timing columns
ruchamahabal Aug 17, 2023
a2465fa
feat: show attendance ID column to quickly navigate to record
ruchamahabal Aug 17, 2023
8fe3c42
fix(report query): apply groupby after where clause
ruchamahabal Aug 17, 2023
59d133e
chore: add report link to Shift workspace
ruchamahabal Aug 17, 2023
6dcfc07
test: fix date formatting
ruchamahabal Aug 17, 2023
13ca6da
test: advance deduction in accrual journal entry
ruchamahabal Aug 17, 2023
8d1c150
refactor: use Duration instead of Time for Late Entry/Early Exit By
krantheman Aug 18, 2023
7c9014d
feat: add Report to Shift & Attendance Workspace
krantheman Aug 21, 2023
02f4a7f
fix(linter): no newline at end of file
krantheman Aug 22, 2023
06a673d
fix: add permission for employee
ruchamahabal Aug 22, 2023
c41a80a
Merge pull request #775 from krantheman/shift_attendance_report
mergify[bot] Aug 22, 2023
046d7d6
fix(Shift Type): rename `enable_(entry/exit)_grace_period` to `enable…
krantheman Aug 22, 2023
05db799
fix(Shift Attendance): rename enable_grace_period fields as enable_ma…
krantheman Aug 22, 2023
92fb1ac
Merge pull request #796 from ruchamahabal/fix-emp-adv-return
ruchamahabal Aug 23, 2023
74b7a4b
fix: allow optional tax component addition & removal (#814)
ruchamahabal Aug 23, 2023
266f270
fix(FnF): don't fetch outstanding statements on every save (#797)
niyazrazak Aug 23, 2023
5907423
chore: merge common code and break larger functions into smaller func…
saurabh6790 Apr 13, 2023
ef56528
feat: cache holiday list
saurabh6790 Apr 19, 2023
aff125a
feat: cache leave type mapper
saurabh6790 Apr 19, 2023
82d3ab2
feat: cache putput of get_value api for salary component
saurabh6790 Apr 19, 2023
03b50e8
feat: add missing indexes
saurabh6790 Apr 20, 2023
6124c1c
feat: rewrite get_lwp_ppl for date
saurabh6790 Apr 20, 2023
14bade9
feat: do not run postprosess if calling from salary slip
saurabh6790 Apr 20, 2023
1eee91d
feat: add composite index
saurabh6790 Apr 20, 2023
44c6eb1
feat: add caching
saurabh6790 Apr 21, 2023
3dd9b60
feat: add property setter for joining_date and relieving_date, set ss…
saurabh6790 Apr 21, 2023
b32e996
feat: add indexing
saurabh6790 Apr 25, 2023
51f37a3
fix: caching
saurabh6790 Apr 25, 2023
753c597
feat: use cahced version of salary structure in doc mapping
saurabh6790 May 31, 2023
a317320
fix: use get_cached_doc instead of get_value with cache true
saurabh6790 May 31, 2023
c874bdd
fix: get employee holiday dates
saurabh6790 May 31, 2023
c69650f
fix: do not use cached version in testing
saurabh6790 May 31, 2023
2a4f7d2
fix: dates based on joining and relieving date
saurabh6790 May 31, 2023
c19207c
fix: test case and caching
saurabh6790 Jun 7, 2023
db839f1
chore: multiple fixes
saurabh6790 Jun 28, 2023
d722808
chore: resolve merge conflicts
saurabh6790 Jul 12, 2023
f270176
fix: test case
saurabh6790 Jul 12, 2023
0f15e1b
fix: do not exclude process_salary_structure
saurabh6790 Aug 23, 2023
00d4ce5
fix: use existing holiday list fn instead of changing other fn defs
ruchamahabal Aug 23, 2023
ef196ee
refactor: replace db cache with `get_cached_value` for fetching >1 va…
ruchamahabal Aug 23, 2023
e5e6f71
fix: incorrect db cache call
ruchamahabal Aug 23, 2023
a3e6e04
fix: reduce db/fn calls + fix hasattr check
ruchamahabal Aug 23, 2023
671f892
fix: add missing employee mapping from structure -> slip
ruchamahabal Aug 23, 2023
7ad3cac
fix: `get_single_value` calls are cached by default
ruchamahabal Aug 23, 2023
f379f0d
fix: lwp calculation, missing filter in query & typo
ruchamahabal Aug 23, 2023
320099f
refactor: replace db cache with `get_cached_value` for fetching >1 va…
ruchamahabal Aug 24, 2023
97a082d
fix: holiday date type casting
ruchamahabal Aug 24, 2023
ed04ffb
test: add regression test for half day lwp in leave-based payroll
ruchamahabal Aug 24, 2023
4cb4561
refactor: `calculate_lwp_or_ppl_based_on_leave_application`
ruchamahabal Aug 24, 2023
5c62cbe
refactor(caching): replace unnecessary hashes with value cache
ruchamahabal Aug 24, 2023
45023a5
fix: add missing cache invalidation
ruchamahabal Aug 24, 2023
7b8fa0a
test(fix): clear cache in tests
ruchamahabal Aug 24, 2023
668a946
perf: cache payroll period fn calls
ruchamahabal Aug 24, 2023
4424aa1
fix: create constants for cache keys
ruchamahabal Aug 24, 2023
78ea7bd
Merge pull request #470 from saurabh6790/performance-fixes-salary-slip
ruchamahabal Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hrms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
"hrms.overrides.company.set_default_hr_accounts",
],
},
"Holiday List": {
"on_update": "hrms.utils.holiday_list.invalidate_cache",
"on_trash": "hrms.utils.holiday_list.invalidate_cache",
},
"Timesheet": {"validate": "hrms.hr.utils.validate_active_employee"},
"Payment Entry": {
"on_submit": "hrms.hr.doctype.expense_claim.expense_claim.update_payment_for_expense_claim",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@


class FullandFinalStatement(Document):
def validate(self):
def before_insert(self):
self.get_outstanding_statements()

def validate(self):
self.get_assets_statements()
if self.docstatus == 1:
self.validate_settlement("payables")
self.validate_settlement("receivables")
Expand All @@ -34,15 +37,17 @@ def get_outstanding_statements(self):
if not len(self.get("receivables", [])):
components = self.get_receivable_component()
self.create_component_row(components, "receivables")

if not len(self.get("assets_allocated", [])):
for data in self.get_assets_movement():
self.append("assets_allocated", data)
self.get_assets_statements()
else:
frappe.throw(
_("Set Relieving Date for Employee: {0}").format(get_link_to_form("Employee", self.employee))
)

def get_assets_statements(self):
if not len(self.get("assets_allocated", [])):
for data in self.get_assets_movement():
self.append("assets_allocated", data)

def create_component_row(self, components, component_type):
for component in components:
self.append(
Expand Down
9 changes: 4 additions & 5 deletions hrms/hr/doctype/leave_allocation/leave_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ def validate_leave_days_and_dates(self):
def validate_leave_allocation_days(self):
company = frappe.db.get_value("Employee", self.employee, "company")
leave_period = get_leave_period(self.from_date, self.to_date, company)
max_leaves_allowed = flt(
frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed")
)
max_leaves_allowed = frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed")

if max_leaves_allowed > 0:
leave_allocated = 0
if leave_period:
Expand Down Expand Up @@ -251,8 +250,8 @@ def set_total_leaves_allocated(self):

def limit_carry_forward_based_on_max_allowed_leaves(self):
max_leaves_allowed = frappe.db.get_value("Leave Type", self.leave_type, "max_leaves_allowed")
if max_leaves_allowed and self.total_leaves_allocated > flt(max_leaves_allowed):
self.total_leaves_allocated = flt(max_leaves_allowed)
if max_leaves_allowed and self.total_leaves_allocated > max_leaves_allowed:
self.total_leaves_allocated = max_leaves_allowed
self.unused_leaves = max_leaves_allowed - flt(self.new_leaves_allocated)

def set_carry_forwarded_leaves_in_previous_allocation(self, on_cancel=False):
Expand Down
4 changes: 4 additions & 0 deletions hrms/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,3 +1305,7 @@ def get_leave_approver(employee):
)

return leave_approver


def on_doctype_update():
frappe.db.add_index("Leave Application", ["employee", "from_date", "to_date"])
2 changes: 1 addition & 1 deletion hrms/hr/doctype/leave_type/leave_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
{
"fieldname": "max_leaves_allowed",
"fieldtype": "Int",
"fieldtype": "Float",
"label": "Maximum Leave Allocation Allowed"
},
{
Expand Down
6 changes: 6 additions & 0 deletions hrms/hr/doctype/leave_type/leave_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ def validate_leave_types(self):
self.fraction_of_daily_salary_per_leave < 0 or self.fraction_of_daily_salary_per_leave > 1
):
frappe.throw(_("The fraction of Daily Salary per Leave should be between 0 and 1"))

def clear_cache(self):
from hrms.payroll.doctype.salary_slip.salary_slip import LEAVE_TYPE_MAP

frappe.cache.delete_value(LEAVE_TYPE_MAP)
return super().clear_cache()
36 changes: 18 additions & 18 deletions hrms/hr/doctype/shift_type/shift_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"process_attendance_after",
"last_sync_of_checkin",
"grace_period_settings_auto_attendance_section",
"enable_entry_grace_period",
"enable_late_entry_marking",
"late_entry_grace_period",
"column_break_18",
"enable_exit_grace_period",
"enable_early_exit_marking",
"early_exit_grace_period"
],
"fields": [
Expand Down Expand Up @@ -92,13 +92,7 @@
"label": "Begin check-in before shift start time (in minutes)"
},
{
"default": "0",
"fieldname": "enable_entry_grace_period",
"fieldtype": "Check",
"label": "Enable Entry Grace Period"
},
{
"depends_on": "enable_entry_grace_period",
"depends_on": "enable_late_entry_marking",
"description": "The time after the shift start time when check-in is considered as late (in minutes).",
"fieldname": "late_entry_grace_period",
"fieldtype": "Int",
Expand All @@ -109,13 +103,7 @@
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "enable_exit_grace_period",
"fieldtype": "Check",
"label": "Enable Exit Grace Period"
},
{
"depends_on": "eval:doc.enable_exit_grace_period",
"depends_on": "enable_early_exit_marking",
"description": "The time before the shift end time when check-out is considered as early (in minutes).",
"fieldname": "early_exit_grace_period",
"fieldtype": "Int",
Expand All @@ -138,7 +126,7 @@
"depends_on": "enable_auto_attendance",
"fieldname": "grace_period_settings_auto_attendance_section",
"fieldtype": "Section Break",
"label": "Grace Period Settings For Auto Attendance"
"label": "Late Entry & Early Exit Settings for Auto Attendance"
},
{
"default": "0",
Expand All @@ -165,10 +153,22 @@
"fieldname": "mark_auto_attendance_on_holidays",
"fieldtype": "Check",
"label": "Mark Auto Attendance on Holidays"
},
{
"default": "0",
"fieldname": "enable_late_entry_marking",
"fieldtype": "Check",
"label": "Enable Late Entry Marking"
},
{
"default": "0",
"fieldname": "enable_early_exit_marking",
"fieldtype": "Check",
"label": "Enable Early Exit Marking"
}
],
"links": [],
"modified": "2023-05-02 11:49:20.020685",
"modified": "2023-08-22 11:31:24.381593",
"modified_by": "Administrator",
"module": "HR",
"name": "Shift Type",
Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/shift_type/shift_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ def get_attendance(self, logs):
logs, self.determine_check_in_and_check_out, self.working_hours_calculation_based_on
)
if (
cint(self.enable_entry_grace_period)
cint(self.enable_late_entry_marking)
and in_time
and in_time > logs[0].shift_start + timedelta(minutes=cint(self.late_entry_grace_period))
):
late_entry = True

if (
cint(self.enable_exit_grace_period)
cint(self.enable_early_exit_marking)
and out_time
and out_time < logs[0].shift_end - timedelta(minutes=cint(self.early_exit_grace_period))
):
Expand Down
4 changes: 2 additions & 2 deletions hrms/hr/doctype/shift_type/test_shift_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def test_entry_and_exit_grace(self):
# doesn't mark late entry until 60 mins after shift start i.e. till 9
# doesn't mark late entry until 60 mins before shift end i.e. 11
shift_type = setup_shift_type(
enable_entry_grace_period=1,
enable_exit_grace_period=1,
enable_late_entry_marking=1,
enable_early_exit_marking=1,
late_entry_grace_period=60,
early_exit_grace_period=60,
)
Expand Down
Empty file.
73 changes: 73 additions & 0 deletions hrms/hr/report/shift_attendance/shift_attendance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

frappe.query_reports["Shift Attendance"] = {
filters: [
{
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
reqd: 1,
default: frappe.datetime.month_start(),
},
{
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
reqd: 1,
default: frappe.datetime.month_end(),
},
{
fieldname: "employee",
label: __("Employee"),
fieldtype: "Link",
options: "Employee",
},
{
fieldname: "shift",
label: __("Shift Type"),
fieldtype: "Link",
options: "Shift Type",
},
{
fieldname: "department",
label: __("Department"),
fieldtype: "Link",
options: "Department",
},
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
reqd: 1,
default: frappe.defaults.get_user_default("Company"),
},
{
fieldname: "late_entry",
label: __("Late Entry"),
fieldtype: "Check",
},
{
fieldname: "early_exit",
label: __("Early Exit"),
fieldtype: "Check",
},
{
fieldname: "consider_grace_period",
label: __("Consider Grace Period"),
fieldtype: "Check",
default: 1
},
],
formatter: (value, row, column, data, default_formatter) => {
value = default_formatter(value, row, column, data);
if (
(column.fieldname === "in_time" && data.late_entry) ||
(column.fieldname === "out_time" && data.early_exit)
) {
value = `<span style='color:red!important'>${value}</span>`;
}
return value;
},
};
38 changes: 38 additions & 0 deletions hrms/hr/report/shift_attendance/shift_attendance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"add_total_row": 0,
"columns": [],
"creation": "2023-08-04 11:29:44.327488",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 0,
"is_standard": "Yes",
"letterhead": null,
"modified": "2023-08-04 11:29:44.327488",
"modified_by": "Administrator",
"module": "HR",
"name": "Shift Attendance",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Attendance",
"report_name": "Shift Attendance",
"report_type": "Script Report",
"roles": [
{
"role": "HR User"
},
{
"role": "System Manager"
},
{
"role": "HR Manager"
},
{
"role": "Employee Self Service"
},
{
"role": "Employee"
}
]
}
Loading
Loading