wbhuman_resources 1.56.1__py2.py3-none-any.whl → 1.56.2__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,6 +50,7 @@ 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
 
54
55
  from .absence import AbsenceRequest, AbsenceRequestPeriods
55
56
  from .calendars import DayOff, DayOffCalendar, DefaultDailyPeriod
@@ -235,11 +236,6 @@ class EmployeeHumanResource(ComplexToStringMixin, WBModel):
235
236
  title="Vacation Notification",
236
237
  help_text="Notifies you when there are Vacation days that you still have to take",
237
238
  ),
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
239
  ]
244
240
 
245
241
  def unassign_position_groups(self):
@@ -1213,3 +1209,22 @@ def deactivate_profile_as_task(requester_id: int, employee_id: int, substitute_i
1213
1209
  body=gettext("The following actions have been done: \n{messages}").format(messages=messages),
1214
1210
  user=requester,
1215
1211
  )
1212
+
1213
+
1214
+ @receiver(add_employee_activity_to_daily_brief, sender="directory.Person")
1215
+ def daily_birthday(sender, instance: Person, val_date: date, **kwargs) -> tuple[str, str] | None:
1216
+ """
1217
+ Cron task supposed to be ran every day. Check and notify employee about a colleague's birthday.
1218
+ """
1219
+ birthday_firstnames = list(
1220
+ EmployeeHumanResource.active_internal_employees.filter(
1221
+ Q(profile__birthday__day=val_date.day) & Q(profile__birthday__month=val_date.month)
1222
+ )
1223
+ .exclude(profile=instance)
1224
+ .values_list("profile__first_name", flat=True)
1225
+ )
1226
+ if birthday_firstnames:
1227
+ birthday_firstnames_humanized = f"{', '.join(birthday_firstnames[:-1])} and {birthday_firstnames[-1]}"
1228
+ return "Today Birthdays", _("Today is {}'s birthday, Which them a happy birthday!").format(
1229
+ birthday_firstnames_humanized
1230
+ )
@@ -29,30 +29,6 @@ def create_future_public_holiday(today: date | None = None, forecast_year: int =
29
29
  calendar.create_public_holidays(year)
30
30
 
31
31
 
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
32
  @shared_task
57
33
  def assign_balance(today=None):
58
34
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbhuman_resources
3
- Version: 1.56.1
3
+ Version: 1.56.2
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,7 @@
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=tQ6MYa9Zw4yaozubNFo80osqAHY7z4usSAc-Kp5ikJA,7786
4
+ wbhuman_resources/tasks.py,sha256=RzGg98F2Rjilehhw7rKa_8AWEZrDyUPwVUBRs0q1r50,6773
5
5
  wbhuman_resources/urls.py,sha256=FfpMuxZejfMt3xVu18WOa2aXC4ht2-MIESRmC_GUuIU,7980
6
6
  wbhuman_resources/utils.py,sha256=EZNxathbV_Azj1XX489X78WDbiNwj6F5FUqBqMrV2sg,1487
7
7
  wbhuman_resources/admin/__init__.py,sha256=hXIquTlOG4HFeeMetc6T1LwNJmFc9HBbtpCAQsgV8oM,113
@@ -43,7 +43,7 @@ wbhuman_resources/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
43
43
  wbhuman_resources/models/__init__.py,sha256=PW4LDmMpJqcynmnbdy_VSwbhxyDU9ZCR2LIXk6LkHlg,631
44
44
  wbhuman_resources/models/absence.py,sha256=WDepyQjrySU860ESSZRP4Z13UlenMZD5JTsDS8Bm7xY,35892
45
45
  wbhuman_resources/models/calendars.py,sha256=TjUaabVldDY4baZN9tGVJA609LUAZV2pCowTCEa4VYA,14621
46
- wbhuman_resources/models/employee.py,sha256=qj8mGcC4sOMLj6Qh7ppDMG82o35T1xvU2VHhKRrZ5Sg,49046
46
+ wbhuman_resources/models/employee.py,sha256=9IE00cJJ-qvMjYYnobxG0JM60xeBpqUfwvkf5Cs-LSc,49710
47
47
  wbhuman_resources/models/kpi.py,sha256=BrYKb56MKm5Ya0sIav3-jmw0qk4zKNoSRr0bYfNM9mk,7270
48
48
  wbhuman_resources/models/preferences.py,sha256=iQhcu-jrEkk8DgM5hgakg5mdkbtlO11KeJC0QpTBcKI,1432
49
49
  wbhuman_resources/models/review.py,sha256=QXXckJclht6iAw75_QL6bva4urHeSeUgbu4D_lsmiaw,39414
@@ -105,6 +105,6 @@ wbhuman_resources/viewsets/titles/absence.py,sha256=4F4ENgmZBGKiDuC8DmgrklNXEsRo
105
105
  wbhuman_resources/viewsets/titles/employee.py,sha256=VP_AC3E-3fpbO8-RUvi2haXcoJr9LVLYtJifGawVRGo,565
106
106
  wbhuman_resources/viewsets/titles/kpis.py,sha256=OSH_vIsIjfThWn17X_K7ykBKAFqNvz8M4PyFCF8BRQo,491
107
107
  wbhuman_resources/viewsets/titles/review.py,sha256=fL_PqTNAIK7alk_-7RaklkiR9guh54u8oS0m5AWOSSc,2458
108
- wbhuman_resources-1.56.1.dist-info/METADATA,sha256=PdBOe90qM8vXBYOkLHz6ENf21DzNPaNxv6gAXt8J8dE,272
109
- wbhuman_resources-1.56.1.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
110
- wbhuman_resources-1.56.1.dist-info/RECORD,,
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,,