phamos-eu / HR-Addon

HR Add-on for ERPNext
Other
19 stars 39 forks source link

Workday - add addtional information #84

Closed ReachyBayern closed 1 week ago

ReachyBayern commented 3 months ago

current problems:

Proposal:

server-scripts and client scripts could be sent as example if this is usefull.

wojosc commented 3 months ago

thanks you for sharing this. Yes, please also add the scripts as they will be helpful.

@reggaetuna please go over this list and give feedback to what might already be part of the app and just needs understanding/clarification through documentation, what might be worked on in the develop branch already.

Thanks

ReachyBayern commented 3 months ago

client script workday - fieldupdate (target_hours)

frappe.ui.form.on('Workday', {
    target_hours: function(frm, cdt, cdn) {
        console.log('setting total_target_second.....s');
        frappe.model.set_value(cdt, cdn, 'total_target_seconds', frappe.model.get_value(cdt, cdn, 'target_hours')*3600);

    }
});
ReachyBayern commented 3 months ago

server script workday - before save: to calculate breaks for hours >9 and multiple checkins

l_exp_break_hours = float(doc.expected_break_hours) l_hours_worked = float(doc.hours_worked) l_set_break_time_after_9h = doc.custom_set_break_time_after_9h l_break_time_after_9_h = doc.custom_break_time_after_9h if (l_hours_worked >= 9 and l_exp_break_hours < 0.75 and l_set_break_time_after_9h ): l_exp_break_hours = 0.75 doc.expected_break_hours = 0.75 l_break_count = (len(doc.employee_checkins) 0.5 ) - 1 if (l_break_count >= 0): l_break_hours = float(doc.break_hours) l_new_break_seconds = (l_exp_break_hours - l_break_hours) 3600 if (l_new_break_seconds <= 0): l_new_break_seconds = 0 l_new_working_hours = l_hours_worked - (l_new_break_seconds / 3600 ) doc.actual_working_hours = l_new_working_hours doc.total_break_seconds = l_new_break_seconds doc.number_of_breaks = l_break_count else: doc.number_of_breaks = 0

beingeek commented 1 week ago

version-14 and version-15 is updated and issue resolved