else:
return ' - '.join((str(self.date_from), str(self.date_to)))
-
- class PersonActivityHebdoHourVolume(models.Model):
-
- activity = models.ForeignKey('PersonActivity', verbose_name=_('activity'))
- monday_hours = models.IntegerField(_('monday hours'), blank=True, null=True)
- tuesday_hours = models.IntegerField(_('tuesday hours'), blank=True, null=True)
- wednesday_hours = models.IntegerField(_('wednesday hours'), blank=True, null=True)
- thursday_hours = models.IntegerField(_('thursday hours'), blank=True, null=True)
- friday_hours = models.IntegerField(_('friday hours'), blank=True, null=True)
+ def save(self, *args, **kwargs):
+ super(PersonActivity, self).save(args, kwargs)
+ if self.weekly_hour_volume :
+ # caution : if 0 return False
+ # caution : 'None' is not empty
+ if not self.monday_hours.__str__() != 'None' and \
+ not self.tuesday_hours.__str__() != 'None' and \
+ not self.wednesday_hours.__str__() != 'None' and \
+ not self.thursday_hours.__str__() != 'None' and \
+ not self.friday_hours.__str__() != 'None' :
+ self.monday_hours = self.weekly_hour_volume.monday_hours
+ self.tuesday_hours = self.weekly_hour_volume.tuesday_hours
+ self.wednesday_hours = self.weekly_hour_volume.wednesday_hours
+ self.thursday_hours = self.weekly_hour_volume.thursday_hours
+ self.friday_hours = self.weekly_hour_volume.friday_hours
+ self.save()
+
+
+class PersonActivityTimeSheet(models.Model):
+
+ activity = models.ForeignKey('PersonActivity', verbose_name=_('activity'), related_name='timesheets')
+ project = models.ForeignKey('organization-projects.Project', verbose_name=_('project'), related_name='timesheets')
+ work_packages = models.ManyToManyField('organization-projects.ProjectWorkPackage', verbose_name=_('work package'), related_name='timesheets', blank=True)
+ percentage = models.IntegerField(_('% of work time on the project'))
+ month = models.IntegerField(_('month'))
+ year = models.IntegerField(_('year'))
+
+ @property
+ def date(self):
+ pass
+
+ class Meta:
+ verbose_name = _('activity timesheet')
+ verbose_name_plural = _('activity timesheets')
+ ordering = ['month',]
+
+
+class PersonActivityVacation(Period):
+
+ activity = models.ForeignKey('PersonActivity', verbose_name=_('activity'))