Skip to content

Commit

Permalink
[ADD] hr_attendance_webcam
Browse files Browse the repository at this point in the history
  • Loading branch information
adasatorres committed Oct 3, 2024
1 parent 4bd6d75 commit ded8748
Show file tree
Hide file tree
Showing 25 changed files with 2,101 additions and 0 deletions.
88 changes: 88 additions & 0 deletions hr_attendance_webcam/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
=================
Attendance Webcam
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b3153a7bbfe0853dc24e2c73eb45e17b1d09a6dc2711d34a58b93240d1dc65cd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--attendance-lightgray.png?logo=github
:target: https://github.com/OCA/hr-attendance/tree/16.0/hr_attendance_webcam
:alt: OCA/hr-attendance
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-attendance-16-0/hr-attendance-16-0-hr_attendance_webcam
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-attendance&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon allows you to take a picture of the employee when they check in/out.


**Table of contents**

.. contents::
:local:

Usage
=====

* First go to "Settings" > "Attendance" > enable "Image Capture".
* After enabling the "Image Capture" option, you can take a picture of the employee when they check in/out.
* You can see a check in/out image in the Attendance view Form.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-attendance/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/hr-attendance/issues/new?body=module:%20hr_attendance_webcam%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Binhex

Contributors
~~~~~~~~~~~~

* `Binhex <http://binhex.cloud>`_:

* Adasat Torres de León <[email protected]>
* Zuzanna Elzbieta Szalaty Szalaty <[email protected]>
* Christian Ramos Barrera <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/hr-attendance <https://github.com/OCA/hr-attendance/tree/16.0/hr_attendance_webcam>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions hr_attendance_webcam/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions hr_attendance_webcam/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Attendance Webcam",
"summary": """
This addon allows you to take a picture of the employee when they check in/out.
""",
"author": "Binhex, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr-attendance",
"license": "AGPL-3",
"category": "Human Resources",
"version": "16.0.1.0.0",
"depends": ["hr_attendance"],
"data": [
"security/hr_attendance_security.xml",
"views/hr_attendance_view.xml",
"views/res_config_settings_views.xml",
],
"assets": {
"web.assets_backend": [
"hr_attendance_webcam/static/src/**/*",
],
},
}
3 changes: 3 additions & 0 deletions hr_attendance_webcam/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import hr_employee
from . import hr_attendance
from . import res_config_settings
11 changes: 11 additions & 0 deletions hr_attendance_webcam/models/hr_attendance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 Binhex - Adasat Torres de León.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

from odoo import fields, models


class HrAttendanceMod(models.Model):
_inherit = "hr.attendance"

image_check_in = fields.Binary("Check-in image", attachment=True)
image_check_out = fields.Binary("Check-out image", attachment=True)
18 changes: 18 additions & 0 deletions hr_attendance_webcam/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import logging

from odoo import models

_logger = logging.getLogger(__name__)


class HrEmployee(models.Model):
_inherit = "hr.employee"

def _attendance_action_change(self):
res = super()._attendance_action_change()
image = self.env.context.get("image", False)
if self.attendance_state == "checked_in" and image:
res.write({"image_check_in": image})
if self.attendance_state == "checked_out" and image:
res.write({"image_check_out": image})
return res
10 changes: 10 additions & 0 deletions hr_attendance_webcam/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

group_attendance_image_capture = fields.Boolean(
string="Image Capture",
implied_group="hr_attendance_webcam.group_hr_attendance_image_capture",
)
5 changes: 5 additions & 0 deletions hr_attendance_webcam/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Binhex <http://binhex.cloud>`_:

* Adasat Torres de León <[email protected]>
* Zuzanna Elzbieta Szalaty Szalaty <[email protected]>
* Christian Ramos Barrera <[email protected]>
2 changes: 2 additions & 0 deletions hr_attendance_webcam/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This addon allows you to take a picture of the employee when they check in/out.

3 changes: 3 additions & 0 deletions hr_attendance_webcam/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* First go to "Settings" > "Attendance" > enable "Image Capture".
* After enabling the "Image Capture" option, you can take a picture of the employee when they check in/out.
* You can see a check in/out image in the Attendance view Form.
12 changes: 12 additions & 0 deletions hr_attendance_webcam/security/hr_attendance_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="group_hr_attendance_image_capture" model="res.groups">
<field name="name">Enable Image Capture</field>
<field name="category_id" ref="base.module_category_hidden" />
<field
name="comment"
>The user will have to take a screenshot of his face.</field>
</record>

</odoo>
Binary file added hr_attendance_webcam/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ded8748

Please sign in to comment.