Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] 11.0 Backport of hr_attendance_report_theoretical_time #559

Merged
merged 7 commits into from
Mar 27, 2019

Conversation

jarroyomorales
Copy link

Backport of hr_attendance_report_theoretical_time to 11.0.
Due to big changes in Odoo 12 regarding hr modules, i have needed to do a hook with resource.calendar.leaves in order to make the domain work properly. I don't know if this is the proper solution...
@jbeficent

pedrobaeza and others added 5 commits February 25, 2019 12:08
Theoretical vs Attended Time Analysis
=====================================

This module adds a new report called "Theoretical vs Attended Time Analysis"
that compares worked time, measured through attendances records, with the
theoretical time, computed from employee's working calendar, public holidays
and employee specific leaves.

There is the possibility of counting as theoretical time some leave types if
specified in them.

Installation
============

On installation time, this module computes the theoretical hours for the day of
the attendance check-in, so if you have a lot of records, this would be a bit
slow.

Configuration
=============

You need to be at least "Attendance / Manual Attendance" for being able to see
the attendances report.

For including some leave types in the theoretical time, you have to:

* Go to Leaves > Configuration.
* Select leave type you want to include.
* Check the mark "Include in theoretical hours".

Usage
=====

* Go to *Attendances > Reports > Theoretical vs Attended Time Analysis*.
* Check pivot table or look at the graph view.

Known issues / Roadmap
======================

* Employees with less than 1 week in the company will show full week
  theoretical hours.
* Activate ORM cache for improving performance on computing theoretical hours,
  but assuring that the cache is cleared when the conditions of the computation
  changes.
* If you change employee's working time, theoretical hours for non attended
  days will be computed according this new calendar. You have to define
  start and end dates inside the calendar for avoiding this side effect.
* Recompute theoretical hours of affected days when changing the leave type
  to be included or not in theoretical time.
Currently translated at 100.0% (26 of 26 strings)

Translation: hr-10.0/hr-10.0-hr_attendance_report_theoretical_time
Translate-URL: https://translation.odoo-community.org/projects/hr-10-0/hr-10-0-hr_attendance_report_theoretical_time/de/
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
* Standard procedure
* Adapt data model
* Adapt views
* Adapt code for date handling
* Adapt tests
@pedrobaeza pedrobaeza added this to the 11.0 milestone Feb 25, 2019
@@ -6,6 +6,9 @@ class ResourceCalendarLeaves(models.Model):

@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
"""
This function is overrided in order to add the domain into searches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A docstring should explain for what is used the code, no what code does, which is self-explanatory. Try with something like:

Inject extra domain when being called from _theoretical_hours method.
WARNING: This method should be called only once with that context
from a restricted piece of code, or can have side effects.

Copy link
Member

@HviorForgeFlow HviorForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So employees with manual attendance can't see their own report from a menu, but they can access to the view and see all employee attendances.

Would be nice that every employee could access to this menu an see only their own report.

@@ -0,0 +1,28 @@
You need to be at least "Attendance / Manual Attendance" for being able to see
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least you have to be Officer because parent menu requires it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't this way in v10, but on v12 this menu was accessible by all, so you should turn to the changes I was doing in v10 for this. There's a record rule for making that users with manual attendance only see their attendances any way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still being an inconsistency between readme and module functionality at least in v11.
If you want to keep as this way please change readme

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you attend this comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, i forgot, just changed it in #576

Copy link
Sponsor Member

@JordiBForgeFlow JordiBForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Technical and functional review.

Copy link

@AdriaGForgeFlow AdriaGForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code and functional review on runbot. LGTM 👍

<filter name="current_month" string="Current Month" domain="[('date', '&gt;=', datetime.date.today().strftime('%Y-%m-01'))]" />
<filter name="current_year" string="Current Year" domain="[('date', '&gt;=', datetime.date.today().strftime('%Y-01-01'))]" />
<separator/>
<filter name="my" string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" />
Copy link
Member

@nikul-serpentcs nikul-serpentcs Feb 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jarroyomorales name="my_attendances"

@yajo
Copy link
Member

yajo commented Mar 7, 2019

Is this still WIP?

@nikul-serpentcs
Copy link
Member

Is this still WIP?

@yajo I think here access for PR Labels like WIP, Because Every time reviewer asking.
@yajo @pedrobaeza What about that??

@yajo
Copy link
Member

yajo commented Mar 11, 2019

I don't understand what you said, sorry. The PR title starts with WIP, that's why I asked. Is it WIP then?

@nikul-serpentcs
Copy link
Member

I don't understand what you said, sorry. The PR title starts with WIP, that's why I asked. Is it WIP then?

I asking to here we not access PR Labels, So if a developer or PR author access then added WIP stage.
So, No need to asking the Every time.

aaaaaaaaaaaaa

@jarroyomorales jarroyomorales changed the title [WIP] 11.0 Backport of hr_attendance_report_theoretical_time [MIG] 11.0 Backport of hr_attendance_report_theoretical_time Mar 12, 2019
@JordiBForgeFlow JordiBForgeFlow merged commit 99941c1 into OCA:11.0 Mar 27, 2019
@pedrobaeza pedrobaeza mentioned this pull request May 15, 2019
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants