wbhuman_resources 1.56.1__tar.gz → 1.56.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/PKG-INFO +1 -1
  2. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/employee.py +21 -5
  3. wbhuman_resources-1.56.3/wbhuman_resources/signals.py +4 -0
  4. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tasks.py +29 -24
  5. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/.gitignore +0 -0
  6. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/pyproject.toml +0 -0
  7. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/__init__.py +0 -0
  8. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/__init__.py +0 -0
  9. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/absence.py +0 -0
  10. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/calendars.py +0 -0
  11. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/employee.py +0 -0
  12. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/kpi.py +0 -0
  13. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/admin/review.py +0 -0
  14. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/apps.py +0 -0
  15. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/dynamic_preferences_registry.py +0 -0
  16. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/factories/__init__.py +0 -0
  17. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/factories/absence.py +0 -0
  18. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/factories/calendars.py +0 -0
  19. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/factories/employee.py +0 -0
  20. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/factories/kpi.py +0 -0
  21. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/__init__.py +0 -0
  22. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/absence.py +0 -0
  23. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/absence_graphs.py +0 -0
  24. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/calendars.py +0 -0
  25. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/employee.py +0 -0
  26. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/kpi.py +0 -0
  27. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/review.py +0 -0
  28. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/filters/signals.py +0 -0
  29. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/de/LC_MESSAGES/django.mo +0 -0
  30. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/de/LC_MESSAGES/django.po +0 -0
  31. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/de/LC_MESSAGES/django.po.translated +0 -0
  32. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/en/LC_MESSAGES/django.mo +0 -0
  33. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/en/LC_MESSAGES/django.po +0 -0
  34. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/fr/LC_MESSAGES/django.mo +0 -0
  35. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/locale/fr/LC_MESSAGES/django.po +0 -0
  36. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/management/__init__.py +0 -0
  37. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0001_initial_squashed_squashed_0015_alter_absencerequest_calendaritem_ptr_and_more.py +0 -0
  38. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0016_alter_employeehumanresource_options.py +0 -0
  39. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0017_absencerequest_crossborder_country_and_more.py +0 -0
  40. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0018_remove_position_group_position_groups.py +0 -0
  41. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0019_alter_absencerequest_options_alter_kpi_options_and_more.py +0 -0
  42. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0020_alter_employeeyearbalance_year_alter_review_year.py +0 -0
  43. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0021_alter_position_color.py +0 -0
  44. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/0022_remove_review_editable_mode.py +0 -0
  45. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/migrations/__init__.py +0 -0
  46. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/__init__.py +0 -0
  47. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/absence.py +0 -0
  48. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/calendars.py +0 -0
  49. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/kpi.py +0 -0
  50. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/preferences.py +0 -0
  51. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/models/review.py +0 -0
  52. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/permissions/__init__.py +0 -0
  53. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/permissions/backend.py +0 -0
  54. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/__init__.py +0 -0
  55. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/absence.py +0 -0
  56. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/calendars.py +0 -0
  57. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/employee.py +0 -0
  58. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/kpi.py +0 -0
  59. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/serializers/review.py +0 -0
  60. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/templates/review/review_report.html +0 -0
  61. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/__init__.py +0 -0
  62. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/conftest.py +0 -0
  63. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/__init__.py +0 -0
  64. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/test_absences.py +0 -0
  65. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/test_calendars.py +0 -0
  66. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/test_employees.py +0 -0
  67. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/test_review.py +0 -0
  68. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/models/test_utils.py +0 -0
  69. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/signals.py +0 -0
  70. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/test_permission.py +0 -0
  71. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/tests/test_tasks.py +0 -0
  72. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/urls.py +0 -0
  73. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/utils.py +0 -0
  74. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/__init__.py +0 -0
  75. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/absence.py +0 -0
  76. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/absence_charts.py +0 -0
  77. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/buttons/__init__.py +0 -0
  78. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/buttons/absence.py +0 -0
  79. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/buttons/employee.py +0 -0
  80. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/buttons/kpis.py +0 -0
  81. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/buttons/review.py +0 -0
  82. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/calendars.py +0 -0
  83. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/__init__.py +0 -0
  84. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/absence.py +0 -0
  85. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/calendars.py +0 -0
  86. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/employee.py +0 -0
  87. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/kpis.py +0 -0
  88. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/display/review.py +0 -0
  89. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/employee.py +0 -0
  90. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/__init__.py +0 -0
  91. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/absence.py +0 -0
  92. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/calendars.py +0 -0
  93. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/employee.py +0 -0
  94. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/kpis.py +0 -0
  95. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/endpoints/review.py +0 -0
  96. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/kpi.py +0 -0
  97. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/__init__.py +0 -0
  98. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/absence.py +0 -0
  99. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/administration.py +0 -0
  100. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/calendars.py +0 -0
  101. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/employee.py +0 -0
  102. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/kpis.py +0 -0
  103. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/menu/review.py +0 -0
  104. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/mixins.py +0 -0
  105. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/review.py +0 -0
  106. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/titles/__init__.py +0 -0
  107. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/titles/absence.py +0 -0
  108. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/titles/employee.py +0 -0
  109. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/titles/kpis.py +0 -0
  110. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/titles/review.py +0 -0
  111. {wbhuman_resources-1.56.1 → wbhuman_resources-1.56.3}/wbhuman_resources/viewsets/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbhuman_resources
3
- Version: 1.56.1
3
+ Version: 1.56.3
4
4
  Summary: A workbench module for managing human resources.
5
5
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
6
6
  Requires-Dist: wbcore
@@ -51,6 +51,8 @@ from wbcore.models import WBModel
51
51
  from wbcore.models.fields import YearField
52
52
  from wbcore.utils.models import ComplexToStringMixin
53
53
 
54
+ from wbhuman_resources.signals import add_employee_activity_to_daily_brief
55
+
54
56
  from .absence import AbsenceRequest, AbsenceRequestPeriods
55
57
  from .calendars import DayOff, DayOffCalendar, DefaultDailyPeriod
56
58
  from .preferences import (
@@ -235,11 +237,6 @@ class EmployeeHumanResource(ComplexToStringMixin, WBModel):
235
237
  title="Vacation Notification",
236
238
  help_text="Notifies you when there are Vacation days that you still have to take",
237
239
  ),
238
- create_notification_type(
239
- code="wbhuman_resources.employeehumanresource.birthday",
240
- title="Birthday Notification",
241
- help_text="Notifies you when today one of your colleagues is celebrating their birthday",
242
- ),
243
240
  ]
244
241
 
245
242
  def unassign_position_groups(self):
@@ -1213,3 +1210,22 @@ def deactivate_profile_as_task(requester_id: int, employee_id: int, substitute_i
1213
1210
  body=gettext("The following actions have been done: \n{messages}").format(messages=messages),
1214
1211
  user=requester,
1215
1212
  )
1213
+
1214
+
1215
+ @receiver(add_employee_activity_to_daily_brief, sender="directory.Person")
1216
+ def daily_birthday(sender, instance: Person, val_date: date, **kwargs) -> tuple[str, str] | None:
1217
+ """
1218
+ Cron task supposed to be ran every day. Check and notify employee about a colleague's birthday.
1219
+ """
1220
+ birthday_firstnames = list(
1221
+ EmployeeHumanResource.active_internal_employees.filter(
1222
+ Q(profile__birthday__day=val_date.day) & Q(profile__birthday__month=val_date.month)
1223
+ )
1224
+ .exclude(profile=instance)
1225
+ .values_list("profile__first_name", flat=True)
1226
+ )
1227
+ if birthday_firstnames:
1228
+ birthday_firstnames_humanized = f"{', '.join(birthday_firstnames[:-1])} and {birthday_firstnames[-1]}"
1229
+ return "Today Birthdays", _("Today is {}'s birthday, Which them a happy birthday!").format(
1230
+ birthday_firstnames_humanized
1231
+ )
@@ -0,0 +1,4 @@
1
+ from django.db.models.signals import ModelSignal
2
+
3
+ # this signal gathers all activity report needed to be inserted into the daily brief
4
+ add_employee_activity_to_daily_brief = ModelSignal(use_caching=True)
@@ -11,6 +11,7 @@ from django.template.loader import get_template
11
11
  from django.utils.translation import gettext
12
12
  from django.utils.translation import gettext_lazy as _
13
13
  from dynamic_preferences.registries import global_preferences_registry
14
+ from wbcore.contrib.directory.models import Person
14
15
  from wbcore.contrib.notifications.dispatch import send_notification
15
16
  from wbcore.utils.date import current_month_date_end
16
17
  from wbcore.utils.html import convert_html2text
@@ -18,6 +19,7 @@ from wbcore.utils.html import convert_html2text
18
19
  from wbhuman_resources.models import KPI, DayOffCalendar, EmployeeHumanResource, Review
19
20
 
20
21
  from .models.preferences import get_previous_year_balance_expiration_date
22
+ from .signals import add_employee_activity_to_daily_brief
21
23
 
22
24
 
23
25
  @shared_task
@@ -29,30 +31,6 @@ def create_future_public_holiday(today: date | None = None, forecast_year: int =
29
31
  calendar.create_public_holidays(year)
30
32
 
31
33
 
32
- @shared_task
33
- def daily_birthday(today=None):
34
- """
35
- Cron task supposed to be ran every day. Check and notify employee about a colleague's birthday.
36
- """
37
- day = "today"
38
- if not today:
39
- # Notify employee the day before
40
- today = datetime.today() + timedelta(days=1)
41
- day = "tomorrow"
42
- for birthday_employee in EmployeeHumanResource.active_internal_employees.filter(
43
- Q(profile__birthday__day=today.day) & Q(profile__birthday__month=today.month)
44
- ).all():
45
- for employee in EmployeeHumanResource.active_internal_employees.exclude(id=birthday_employee.id):
46
- send_notification(
47
- code="wbhuman_resources.employeehumanresource.birthday",
48
- title=_("{} {}'s birthday is {}!").format(
49
- birthday_employee.profile.first_name, birthday_employee.profile.last_name, day
50
- ),
51
- body=_("Wish her/him a happy birthday!"),
52
- user=employee.profile.user_account,
53
- )
54
-
55
-
56
34
  @shared_task
57
35
  def assign_balance(today=None):
58
36
  """
@@ -188,3 +166,30 @@ def periodic_updating_kpi_task(kpi_id: list | None = None, start=None, end=None)
188
166
  end = kpi.period.upper
189
167
  for date_evaluation in pd.date_range(start=start, end=end, freq=value):
190
168
  kpi.generate_evaluation(date_evaluation.date())
169
+
170
+
171
+ @shared_task
172
+ def daily_brief(today: date | None = None, **kwargs):
173
+ """Creates a summary of the daily brief for all internal employees
174
+ Args:
175
+ today (date | None, optional): Date of today. Defaults to None.
176
+ """
177
+
178
+ if not today:
179
+ today = date.today()
180
+ for employee in EmployeeHumanResource.active_internal_employees.filter(profile__user_account__isnull=False):
181
+ daily_brief = ""
182
+ for receiver, res in add_employee_activity_to_daily_brief.send( # noqa: B007
183
+ sender=Person, instance=employee.profile, val_date=today, **kwargs
184
+ ):
185
+ if res:
186
+ title, html = res
187
+ daily_brief += f"<h2 text-align: center;>{title}</h2>\n<div style='margin-bottom: 1.5em; text-align: left;'>{html}</div>\n"
188
+
189
+ if daily_brief:
190
+ send_notification(
191
+ code="wbcrm.activity.daily_brief",
192
+ title=_("Your Daily Brief"),
193
+ body=daily_brief,
194
+ user=employee.profile.user_account,
195
+ )