@ -0,0 +1,48 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Employee Late Check-in |
|||
====================== |
|||
Employee Late Check-in module for tracking and managing late check-ins of employees and may deduct salary from payslip |
|||
|
|||
Configuration |
|||
============= |
|||
- No additional configuration required. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
* Lesser General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V17) Mohamed Muzammil VP, |
|||
(V18) Gayathri V |
|||
Contact : odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from . import models |
@ -0,0 +1,57 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
|
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
{ |
|||
'name': 'Employee Late Check-in', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Human Resources', |
|||
'summary': 'Employee Late Check-in module for tracking and managing late ' |
|||
'check-ins of employees and may deduct salary from payslip', |
|||
'description': 'The module is designed for meticulous tracking and ' |
|||
'management of employee punctuality. It enables ' |
|||
'organizations to monitor late check-ins efficiently, ' |
|||
'offering insights into tardiness patterns. With a ' |
|||
'user-friendly interface, it provides a comprehensive ' |
|||
'overview of individual employee records, facilitating ' |
|||
'timely interventions. This module contributes to fostering' |
|||
' a punctual and efficient work environment.', |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['hr_attendance', 'hr_payroll_community', 'hr_contract'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'data/ir_cron_data.xml', |
|||
'data/salary_rule.xml', |
|||
'views/res_config_settings_views.xml', |
|||
'views/hr_attendance_views.xml', |
|||
'views/late_check_in_views.xml', |
|||
'views/hr_employee_views.xml', |
|||
'views/hr_payslip_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<!--The daily function late_check_in_records verifies whether employees are tardy.--> |
|||
<record forcecreate="True" id="ir_cron_late_check_in" model="ir.cron"> |
|||
<field name="name">Attendance: Late Check-in</field> |
|||
<field name="model_id" ref="model_hr_attendance"/> |
|||
<field name="state">code</field> |
|||
<field name="code">model.late_check_in_records()</field> |
|||
<field name="user_id" ref="base.user_root" /> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">days</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!--Calculate the amount for the 'Late Check-in' rule.--> |
|||
<record id="late_check_in" model="hr.salary.rule"> |
|||
<field name="name">Late Check-in</field> |
|||
<field name="sequence" eval="6"/> |
|||
<field name="code">LC</field> |
|||
<field name="category_id" ref="hr_payroll_community.DED"/> |
|||
<field name="amount_select">code</field> |
|||
<field name="amount_python_compute"> |
|||
amount = 0 |
|||
try: |
|||
if inputs.LC: |
|||
amount = inputs.LC.amount |
|||
except: |
|||
amount = 0 |
|||
result = -amount</field> |
|||
</record> |
|||
<!--Salary structure for late check-in--> |
|||
<record id="late_check_in_salary_structure" model="hr.payroll.structure"> |
|||
<field name="code">LCS</field> |
|||
<field name="name">Base Salary Structure For Late Check-in</field> |
|||
<field name="rule_ids" eval="[(6, 0, [ref('hr_payroll_community.hr_rule_basic'), |
|||
ref('hr_payroll_community.hr_rule_net'),ref('hr_payroll_community.hr_rule_taxable'), |
|||
ref('late_check_in')])]"/> |
|||
<field name="company_id" ref="base.main_company"/> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,7 @@ |
|||
## Module <employee_late_check_in> |
|||
|
|||
#### 12.02.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial Commit for Employee Late Check-in |
@ -0,0 +1,28 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from . import hr_attendance |
|||
from . import hr_employee |
|||
from . import hr_employees_public |
|||
from . import hr_payslip |
|||
from . import late_check_in |
|||
from . import res_company |
|||
from . import res_config_settings |
@ -0,0 +1,100 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
import pytz |
|||
from datetime import datetime, timedelta |
|||
from odoo import fields, models, api |
|||
|
|||
|
|||
class HrAttendance(models.Model): |
|||
"""Inherit the module to add fields and methods""" |
|||
_inherit = 'hr.attendance' |
|||
|
|||
late_check_in = fields.Integer( |
|||
string="Late Check-in(Minutes)", compute="_compute_late_check_in", |
|||
help="This indicates the duration of the employee's tardiness.", |
|||
store=True) |
|||
|
|||
@api.depends('check_in') |
|||
def _compute_late_check_in(self): |
|||
"""Calculate late check-in minutes for each record in the current Odoo |
|||
model.This method iterates through the records and calculates late |
|||
check-in minutes based on the employee's contract schedule.The |
|||
calculation takes into account the employee's time zone, scheduled |
|||
check-in time, and the actual check-in time.""" |
|||
for rec in self: |
|||
rec.late_check_in = 0.0 |
|||
if rec.employee_id.contract_id: |
|||
for schedule in rec.sudo().employee_id.contract_id.resource_calendar_id.sudo().attendance_ids: |
|||
if (schedule.dayofweek == str( |
|||
rec.sudo().check_in.weekday()) and |
|||
schedule.day_period == 'morning'): |
|||
dt = rec.check_in |
|||
if self.env.user.tz in pytz.all_timezones: |
|||
old_tz = pytz.timezone('UTC') |
|||
new_tz = pytz.timezone(self.env.user.tz) |
|||
dt = old_tz.localize(dt).astimezone(new_tz) |
|||
str_time = dt.strftime("%H:%M") |
|||
check_in_date = datetime.strptime( |
|||
str_time, "%H:%M").time() |
|||
start_date = datetime.strptime( |
|||
'{0:02.0f}:{1:02.0f}'.format(*divmod( |
|||
schedule.hour_from * 60, 60)), "%H:%M").time() |
|||
check_in = timedelta(hours=check_in_date.hour, |
|||
minutes=check_in_date.minute) |
|||
start_date = timedelta(hours=start_date.hour, |
|||
minutes=start_date.minute) |
|||
if check_in > start_date: |
|||
final = check_in - start_date |
|||
rec.sudo().late_check_in = final.total_seconds() / 60 |
|||
|
|||
def late_check_in_records(self): |
|||
"""Function creates records in late.check.in model for the employees |
|||
who were late""" |
|||
minutes_after = int(self.env['ir.config_parameter'].sudo().get_param( |
|||
'late_check_in_after')) or 0 |
|||
max_limit = int(self.env['ir.config_parameter'].sudo().get_param( |
|||
'maximum_minutes')) or 0 |
|||
for rec in self.sudo().search([]): |
|||
if rec.id not in self.env['late.check.in'].sudo().search( |
|||
[]).attendance_id.ids: |
|||
if rec.late_check_in > minutes_after and minutes_after < rec.late_check_in < max_limit: |
|||
self.env['late.check.in'].sudo().create({ |
|||
'employee_id': rec.employee_id.id, |
|||
'late_minutes': rec.late_check_in, |
|||
'date': rec.check_in.date(), |
|||
'attendance_id': rec.id, |
|||
}) |
|||
else: |
|||
self.env['late.check.in'].sudo().search( |
|||
[('attendance_id', '=', rec.id)]).update({ |
|||
'late_minutes': rec.late_check_in, |
|||
'date': rec.check_in.date(), |
|||
'attendance_id': rec.id, |
|||
}) |
|||
|
|||
def unlink(self): |
|||
"""Override the unlink method to delete the corresponding records in |
|||
late.check.in model""" |
|||
for record in self: |
|||
self.env['late.check.in'].sudo().search( |
|||
[('attendance_id', '=', record.id)]).unlink() |
|||
return super(HrAttendance, self).unlink() |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import fields, models, _ |
|||
|
|||
|
|||
class HrEmployee(models.Model): |
|||
"""Inherit the model to add fields and methods""" |
|||
_inherit = 'hr.employee' |
|||
|
|||
late_check_in_count = fields.Integer( |
|||
string="Late Check-In", compute="_compute_late_check_in_count", |
|||
help="Count of employee's late checkin") |
|||
|
|||
def action_to_open_late_check_in_records(self): |
|||
""" |
|||
:return: dictionary defining the action to open the late check-in |
|||
records window. |
|||
:rtype: dict |
|||
""" |
|||
return { |
|||
'name': _('Employee Late Check-in'), |
|||
'domain': [('employee_id', '=', self.id)], |
|||
'res_model': 'late.check.in', |
|||
'type': 'ir.actions.act_window', |
|||
'view_mode': 'list,form', |
|||
'limit': 80} |
|||
|
|||
def _compute_late_check_in_count(self): |
|||
"""Compute the late check-in count""" |
|||
for rec in self: |
|||
rec.late_check_in_count = self.env['late.check.in'].search_count( |
|||
[('employee_id', '=', rec.id)]) |
@ -0,0 +1,52 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import fields, models, _ |
|||
|
|||
|
|||
class HrEmployees(models.Model): |
|||
"""Inherit the model to add fields and functions""" |
|||
_inherit = 'hr.employee.public' |
|||
|
|||
late_check_in_count = fields.Integer( |
|||
string="Late Check-In", compute="_compute_late_check_in_count", |
|||
help="Count of employee's late checkin") |
|||
|
|||
def action_to_open_late_check_in_records(self): |
|||
""" |
|||
:return: dictionary defining the action to open the late check-in |
|||
records window. |
|||
:rtype: dict |
|||
""" |
|||
return { |
|||
'name': _('Employee Late Check-in'), |
|||
'domain': [('employee_id', '=', self.id)], |
|||
'res_model': 'late.check.in', |
|||
'type': 'ir.actions.act_window', |
|||
'view_mode': 'list,form', |
|||
'limit': 80, |
|||
} |
|||
|
|||
def _compute_late_check_in_count(self): |
|||
"""Compute the late check-in count""" |
|||
for rec in self: |
|||
rec.late_check_in_count = self.env['late.check.in'].search_count( |
|||
[('employee_id', '=', rec.id)]) |
@ -0,0 +1,60 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class PayslipLateCheckIn(models.Model): |
|||
"""Inherit the model to add fields and functions""" |
|||
_inherit = 'hr.payslip' |
|||
|
|||
late_check_in_ids = fields.Many2many( |
|||
'late.check.in', string='Late Check-in', |
|||
help='Late check-in records of the employee') |
|||
|
|||
@api.model |
|||
def get_inputs(self, contracts, date_from, date_to): |
|||
"""Function used for writing late check-in record in the payslip input |
|||
list.""" |
|||
res = super().get_inputs(contracts, date_to, |
|||
date_from) |
|||
late_check_in_type = self.env.ref( |
|||
'employee_late_check_in.late_check_in') |
|||
late_check_in_id = self.env['late.check.in'].search( |
|||
[('employee_id', '=', self.employee_id.id), |
|||
('date', '<=', self.date_to), ('date', '>=', self.date_from), |
|||
('state', '=', 'approved')]) |
|||
if late_check_in_id: |
|||
self.late_check_in_ids = late_check_in_id |
|||
input_data = { |
|||
'name': late_check_in_type.name, |
|||
'code': late_check_in_type.code, |
|||
'amount': sum(late_check_in_id.mapped('penalty_amount')), |
|||
'contract_id': self.contract_id.id, |
|||
} |
|||
res.append(input_data) |
|||
return res |
|||
|
|||
def action_payslip_done(self): |
|||
"""Function used for marking deducted Late check-in request.""" |
|||
for rec in self.late_check_in_ids: |
|||
rec.state = 'deducted' |
|||
return super().action_payslip_done() |
@ -0,0 +1,73 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class LateCheckIn(models.Model): |
|||
"""Model to store late check-in records""" |
|||
_name = 'late.check.in' |
|||
_description = 'Late Check In' |
|||
|
|||
name = fields.Char( |
|||
readonly=True, string='Name', help="Reference number of the record") |
|||
employee_id = fields.Many2one('hr.employee', string="Employee", |
|||
help='Late employee') |
|||
late_minutes = fields.Integer(string="Late Minutes", |
|||
help='The field indicates the number of ' |
|||
'minutes the worker is late.') |
|||
date = fields.Date(string="Date", help='Current date') |
|||
penalty_amount = fields.Float(compute="_compute_penalty_amount", |
|||
help='Amount needs to be deducted', |
|||
string="Amount",) |
|||
state = fields.Selection(selection=[('draft', 'Draft'), |
|||
('approved', 'Approved'), |
|||
('refused', 'Refused'), |
|||
('deducted', 'Deducted')], |
|||
string="State", default="draft", |
|||
help='State of the record') |
|||
attendance_id = fields.Many2one('hr.attendance', string='Attendance', |
|||
help='Attendence of the employee') |
|||
|
|||
@api.model |
|||
def create(self, vals_list): |
|||
"""Create a sequence for the model""" |
|||
vals_list['name'] = self.env['ir.sequence'].next_by_code( |
|||
'late.check.in') or '/' |
|||
return super().create(vals_list) |
|||
|
|||
def _compute_penalty_amount(self): |
|||
"""Compute the penalty amount if the employee was late""" |
|||
for rec in self: |
|||
amount = float(self.env['ir.config_parameter'].sudo().get_param( |
|||
'deduction_amount')) |
|||
rec.penalty_amount = amount |
|||
if self.env['ir.config_parameter'].sudo().get_param( |
|||
'deduction_type') == 'minutes': |
|||
rec.penalty_amount = amount * rec.late_minutes |
|||
|
|||
def approve(self): |
|||
"""Change state to approved when approve button clicks""" |
|||
self.state = 'approved' |
|||
|
|||
def reject(self): |
|||
"""Change state refused when refuse button clicks""" |
|||
self.state = 'refused' |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResCompany(models.Model): |
|||
"""Inherit the model to add fields""" |
|||
_inherit = 'res.company' |
|||
|
|||
deduction_amount = fields.Float( |
|||
help='How much amount need to be deducted if a employee was late', |
|||
string="Deduction Amount",) |
|||
currency_id = fields.Many2one( |
|||
'res.currency', default=lambda self: self.env.company.currency_id.id) |
|||
maximum_minutes = fields.Char( |
|||
help="Maximum time limit a employee was considered as late", |
|||
string="Maximum Late Minute") |
|||
late_check_in_after = fields.Char( |
|||
help='When should the late check-in count down starts.', |
|||
string="Late Check-in Starts After",) |
|||
deduction_type = fields.Selection( |
|||
selection=[('minutes', 'Per Minutes'), ('total', 'Per Total')], |
|||
default="minutes", string='Deduction Type', |
|||
help='Type of deduction, (If Per Minutes is chosen then for each ' |
|||
'minutes given amount is deducted, if Per Total is chosen then ' |
|||
'given amount is deducted from the total salary)') |
@ -0,0 +1,65 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################. |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class LateCheckinSettings(models.TransientModel): |
|||
"""Inherit the model to add fields""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
deduction_amount = fields.Float( |
|||
config_parameter='employee_late_check_in.deduction_amount', |
|||
help='How much amount need to be deducted if a employee was late', |
|||
string="Deduction Amount",) |
|||
maximum_minutes = fields.Char( |
|||
config_parameter='employee_late_check_in.maximum_minutes', |
|||
help="Maximum time limit a employee was considered as late", |
|||
string="Maximum Late Minute",default="240") |
|||
late_check_in_after = fields.Char( |
|||
config_parameter='employee_late_check_in.late_check_in_after', |
|||
help='When should the late check-in count down starts.', |
|||
string="Late Check-in Starts After",) |
|||
deduction_type = fields.Selection( |
|||
selection=[('minutes', 'Per Minutes'), ('total', 'Per Total')], |
|||
config_parameter='employee_late_check_in.deduction_type', |
|||
default="minutes", string='Deduction Type', |
|||
help='Type of deduction, (If Per Minutes is chosen then for each ' |
|||
'minutes given amount is deducted, if Per Total is chosen then ' |
|||
'given amount is deducted from the total salary)') |
|||
currency_id = fields.Many2one( |
|||
'res.currency', default=lambda self: self.env.company.currency_id.id) |
|||
|
|||
def set_values(self): |
|||
"""Set values, |
|||
Returns: |
|||
:return: The result of the superclasses' set_values method. |
|||
""" |
|||
res = super(LateCheckinSettings, self).set_values() |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'deduction_amount', self.deduction_amount) |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'maximum_minutes', self.maximum_minutes) |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'late_check_in_after', self.late_check_in_after) |
|||
self.env['ir.config_parameter'].sudo().set_param( |
|||
'deduction_type', self.deduction_type) |
|||
return res |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |