Skip to content

Commit

Permalink
Merge pull request #1294 from VoicuStefan2001/16.0-new-deltatech_work…
Browse files Browse the repository at this point in the history
…_days_report

[16.0][UPD] deltatech_work_days_report: Addig different codes for time off …
  • Loading branch information
dhongu authored Feb 28, 2024
2 parents 68707ba + 8c7352d commit 2446b6d
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 3 deletions.
69 changes: 69 additions & 0 deletions deltatech_work_days_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
================
Work Days Report
================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:55b2dbb24c1c274f14752ee4bfae2ca3f4fd4449fca362b4a7539f1b10bd394a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OPL--1-blue.png
:target: https://www.odoo.com/documentation/master/legal/licenses.html
:alt: License: OPL-1
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github
:target: https://github.com/dhongu/deltatech/tree/16.0/deltatech_work_days_report
:alt: dhongu/deltatech

|badge1| |badge2| |badge3|

This module:
- adds the field "code" in the Time Off Type form
- in the employee menu in list view you can select employees then press "Action" -> "Export Working Days" to
make an Excel file that contains the employees with their hours worked per day number of hours worked in total
, the number of meal vouchers earn by the employee and see the days they were on time off
- if the code field in Time Off Type form is empty the cell will have "ABS" instead of the type of time off code

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/dhongu/deltatech/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/dhongu/deltatech/issues/new?body=module:%20deltatech_work_days_report%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
~~~~~~~

* Terrabit
* Voicu Stefan

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

.. |maintainer-VoicuStefan2001| image:: https://github.com/VoicuStefan2001.png?size=40px
:target: https://github.com/VoicuStefan2001
:alt: VoicuStefan2001

Current maintainer:

|maintainer-VoicuStefan2001|

This module is part of the `dhongu/deltatech <https://github.com/dhongu/deltatech/tree/16.0/deltatech_work_days_report>`_ project on GitHub.

You are welcome to contribute.
6 changes: 6 additions & 0 deletions deltatech_work_days_report/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ class HREmployee(models.Model):
hours_per_day = fields.Selection(
[("4", "4 Hours"), ("6", "6 Hours"), ("8", "8 Hours")], string="Hours per Day", default="8"
)


class HRLeaveType(models.Model):
_inherit = "hr.leave.type"

type_code = fields.Char(string="Code")
6 changes: 6 additions & 0 deletions deltatech_work_days_report/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module:
- adds the field "code" in the Time Off Type form
- in the employee menu in list view you can select employees then press "Action" -> "Export Working Days" to
make an Excel file that contains the employees with their hours worked per day number of hours worked in total
, the number of meal vouchers earn by the employee and see the days they were on time off
- if the code field in Time Off Type form is empty the cell will have "ABS" instead of the type of time off code
10 changes: 10 additions & 0 deletions deltatech_work_days_report/views/hr_employee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
</xpath>
</field>
</record>

<record id="leave_type_form" model="ir.ui.view">
<field name="model">hr.leave.type</field>
<field name="inherit_id" ref="hr_holidays.edit_holiday_status_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='leave_validation_type']" position="after">
<field name="type_code" />
</xpath>
</field>
</record>
</odoo>
10 changes: 7 additions & 3 deletions deltatech_work_days_report/wizard/export_working_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def do_export(self):
]
)
if holiday:
row.append("ABS") # Employee was on vacation
if holiday.holiday_status_id.type_code:
row.append(holiday.holiday_status_id.type_code)
else:
row.append("ABS") # Employee was on vacation
else:
row.append(employee.hours_per_day)
total_hours = total_hours + int(employee.hours_per_day)
Expand All @@ -77,8 +80,9 @@ def do_export(self):
output_buffer.seek(0)

# Set the data_file field with the content of the file
self.write({"state": "get", "name": "prezenta_template_PTC.xlsx", "data_file": output_buffer.getvalue()})
self.data_file = base64.b64encode(output_buffer.getvalue())
self.write(
{"state": "get", "name": "work_day_report.xlsx", "data_file": base64.b64encode(output_buffer.getvalue())}
)
output_buffer.close()

return {
Expand Down

0 comments on commit 2446b6d

Please sign in to comment.