Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add created to Vacation model, fix PDF dates, update migrations #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions templates/vacations_app/vacation_print_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</tr>
</table>
<div class="content">
<p class="date">Mendoza, <b><u>{% now 'd \d\e F \d\e Y' %}</u></b></p>
<p class="date">Mendoza, <b><u>{{object.created | date:"F j, Y"}}</u></b></p>
<p class="paragraph">
Por medio de la presente, se deja constancia del acuerdo entre
<b><u>{{object.employee.first_name}} {{object.employee.last_name}}</u></b>,
Expand All @@ -90,11 +90,11 @@

<p class="paragraph">
Las mismas comienzan el día
<b><u>{{object.from_date}}</u></b>
<b><u>{{object.from_date | date:"F j, Y"}}</u></b>
y finalizan el día
<b><u>{{object.to_date}}</u></b>,
<b><u>{{object.to_date | date:"F j, Y"}}</u></b>,
retomando sus labores habituales el día
<b><u>{{object.to_date_next_day}}</u></b>.
<b><u>{{object.to_date_next_day | date:"F j, Y"}}</u></b>.
Finalizada esta licencia,
el saldo de vacaciones correspondiente a dicho periodo es de
<b><u>{{object.year_vacation_left}}</u></b> días.
Expand Down
22 changes: 22 additions & 0 deletions vacations_app/migrations/0008_vacation_created.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-11-12 12:55
from __future__ import unicode_literals

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('vacations_app', '0007_assignedvacations'),
]

operations = [
migrations.AddField(
model_name='vacation',
name='created',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
]
8 changes: 2 additions & 6 deletions vacations_app/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from datetime import date, timedelta
from django.db import models
from django.contrib.auth.models import PermissionsMixin
Expand Down Expand Up @@ -90,7 +87,7 @@ def get_short_name(self):


class Vacation(models.Model):

created = models.DateTimeField(auto_now_add=True)
from_date = models.DateField()
days_quantity = models.IntegerField()
to_date = models.DateField()
Expand All @@ -109,8 +106,7 @@ def year_vacation_left(self):
)
total = 0
for vacation in vacations:
vacation_diff = vacation.to_date - vacation.from_date
total += vacation_diff.days
total += vacation.days_quantity
return self.employee.initial_annual_vacations_days - total


Expand Down
2 changes: 0 additions & 2 deletions vacations_app/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from io import BytesIO
from datetime import timedelta

Expand Down