Skip to content

Commit

Permalink
Merge pull request #1295 from VoicuStefan2001/15.0
Browse files Browse the repository at this point in the history
[15.0][UPD] deltatech_work_days_report
  • Loading branch information
dhongu authored Feb 28, 2024
2 parents cfde4a8 + 4a748da commit 5bc3778
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 6 deletions.
8 changes: 7 additions & 1 deletion deltatech_work_days_report/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Work Days Report
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:142a4e37640663f59f9e7d67587c410b09388e09df0294e86ff5993560ab339c
!! source digest: sha256:8e724a4f70b41fc67f801cfabfeea93e245d52bfd5d0db7370b95717f3231fee
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -22,6 +22,12 @@ Work Days Report

|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**

Expand Down
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
2 changes: 1 addition & 1 deletion deltatech_work_days_report/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_working_days_export,access_working_days_export,model_working_days_export,base.group_user,1,1,1,1
deltatech_work_days_report.access_working_days_export,access_working_days_export,deltatech_work_days_report.model_working_days_export,base.group_user,1,1,1,1
13 changes: 12 additions & 1 deletion deltatech_work_days_report/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,20 @@ <h1 class="title">Work Days Report</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:142a4e37640663f59f9e7d67587c410b09388e09df0294e86ff5993560ab339c
!! source digest: sha256:8e724a4f70b41fc67f801cfabfeea93e245d52bfd5d0db7370b95717f3231fee
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="https://www.odoo.com/documentation/master/legal/licenses.html"><img alt="License: OPL-1" src="https://img.shields.io/badge/licence-OPL--1-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/deltatech/tree/15.0/deltatech_work_days_report"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
<dt>This module:</dt>
<dd><ul class="first last simple">
<li>adds the field “code” in the Time Off Type form</li>
<li>in the employee menu in list view you can select employees then press “Action” -&gt; “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</li>
<li>if the code field in Time Off Type form is empty the cell will have “ABS” instead of the type of time off code</li>
</ul>
</dd>
</dl>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down
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 5bc3778

Please sign in to comment.