wbhuman_resources 1.56.2__py2.py3-none-any.whl → 1.56.3__py2.py3-none-any.whl

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.
@@ -50,7 +50,8 @@ from wbcore.contrib.notifications.utils import create_notification_type
50
50
  from wbcore.models import WBModel
51
51
  from wbcore.models.fields import YearField
52
52
  from wbcore.utils.models import ComplexToStringMixin
53
- from wbcrm.signals import add_employee_activity_to_daily_brief
53
+
54
+ from wbhuman_resources.signals import add_employee_activity_to_daily_brief
54
55
 
55
56
  from .absence import AbsenceRequest, AbsenceRequestPeriods
56
57
  from .calendars import DayOff, DayOffCalendar, DefaultDailyPeriod
@@ -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
@@ -164,3 +166,30 @@ def periodic_updating_kpi_task(kpi_id: list | None = None, start=None, end=None)
164
166
  end = kpi.period.upper
165
167
  for date_evaluation in pd.date_range(start=start, end=end, freq=value):
166
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
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbhuman_resources
3
- Version: 1.56.2
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
@@ -1,7 +1,8 @@
1
1
  wbhuman_resources/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
2
  wbhuman_resources/apps.py,sha256=UPXBSjg_i7Zo00IPxMuxV7iYEsY1GWIu217R_ZqEWR8,675
3
3
  wbhuman_resources/dynamic_preferences_registry.py,sha256=Piydi7FVWyzuQK6BDGEVmoP2CyCwqOEJdxgiErsNo4w,4107
4
- wbhuman_resources/tasks.py,sha256=RzGg98F2Rjilehhw7rKa_8AWEZrDyUPwVUBRs0q1r50,6773
4
+ wbhuman_resources/signals.py,sha256=TASaTxZasod_LPyqDtsn4RLfc9YFnDWSA0v78lIViqM,204
5
+ wbhuman_resources/tasks.py,sha256=hE3i9OgoqzI_sjqiiOEyX5yGFvX4nJT9WyWHLYg0teU,7920
5
6
  wbhuman_resources/urls.py,sha256=FfpMuxZejfMt3xVu18WOa2aXC4ht2-MIESRmC_GUuIU,7980
6
7
  wbhuman_resources/utils.py,sha256=EZNxathbV_Azj1XX489X78WDbiNwj6F5FUqBqMrV2sg,1487
7
8
  wbhuman_resources/admin/__init__.py,sha256=hXIquTlOG4HFeeMetc6T1LwNJmFc9HBbtpCAQsgV8oM,113
@@ -43,7 +44,7 @@ wbhuman_resources/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
43
44
  wbhuman_resources/models/__init__.py,sha256=PW4LDmMpJqcynmnbdy_VSwbhxyDU9ZCR2LIXk6LkHlg,631
44
45
  wbhuman_resources/models/absence.py,sha256=WDepyQjrySU860ESSZRP4Z13UlenMZD5JTsDS8Bm7xY,35892
45
46
  wbhuman_resources/models/calendars.py,sha256=TjUaabVldDY4baZN9tGVJA609LUAZV2pCowTCEa4VYA,14621
46
- wbhuman_resources/models/employee.py,sha256=9IE00cJJ-qvMjYYnobxG0JM60xeBpqUfwvkf5Cs-LSc,49710
47
+ wbhuman_resources/models/employee.py,sha256=KJvCjCMWRQQsnkqizKMwBMWmN2QT33JRX-8h_0OnrS4,49723
47
48
  wbhuman_resources/models/kpi.py,sha256=BrYKb56MKm5Ya0sIav3-jmw0qk4zKNoSRr0bYfNM9mk,7270
48
49
  wbhuman_resources/models/preferences.py,sha256=iQhcu-jrEkk8DgM5hgakg5mdkbtlO11KeJC0QpTBcKI,1432
49
50
  wbhuman_resources/models/review.py,sha256=QXXckJclht6iAw75_QL6bva4urHeSeUgbu4D_lsmiaw,39414
@@ -105,6 +106,6 @@ wbhuman_resources/viewsets/titles/absence.py,sha256=4F4ENgmZBGKiDuC8DmgrklNXEsRo
105
106
  wbhuman_resources/viewsets/titles/employee.py,sha256=VP_AC3E-3fpbO8-RUvi2haXcoJr9LVLYtJifGawVRGo,565
106
107
  wbhuman_resources/viewsets/titles/kpis.py,sha256=OSH_vIsIjfThWn17X_K7ykBKAFqNvz8M4PyFCF8BRQo,491
107
108
  wbhuman_resources/viewsets/titles/review.py,sha256=fL_PqTNAIK7alk_-7RaklkiR9guh54u8oS0m5AWOSSc,2458
108
- wbhuman_resources-1.56.2.dist-info/METADATA,sha256=aULUHs43puj4KScHfXNRTIYan5mynz3NpBC0xWX5Mo4,272
109
- wbhuman_resources-1.56.2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
110
- wbhuman_resources-1.56.2.dist-info/RECORD,,
109
+ wbhuman_resources-1.56.3.dist-info/METADATA,sha256=zwlRsXFfifZsd4TejirTZw-2aNaRb6G2iFRSS1bO5Tc,272
110
+ wbhuman_resources-1.56.3.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
111
+ wbhuman_resources-1.56.3.dist-info/RECORD,,