Skip to content

Commit

Permalink
use older timesheet dates
Browse files Browse the repository at this point in the history
  • Loading branch information
yomguy committed Mar 24, 2022
1 parent d691414 commit 485dc5c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions organization/network/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,15 @@ def copy_activity_timesheets(self, request, queryset):
work_packages = timesheet.work_packages.all()
timesheet.id = None
timesheet.month = month
last_other_timesheets = PersonActivityTimeSheet.objects.filter(
activity=timesheet.activity,
year=timesheet.year,
month=timesheet.month).order_by('-validation')

if last_other_timesheets:
timesheet.accounting = last_other_timesheets[0].accounting
timesheet.validation = last_other_timesheets[0].validation

timesheet.save()
for work_package in work_packages:
timesheet.work_packages.add(work_package)
Expand Down

0 comments on commit 485dc5c

Please sign in to comment.