Total leaves of employee not shown
Closed this issue · 15 comments
Bug Report
The total amount of leaves of an employee are not shown, eg. not in their profile.
Therefore it's not clear how many leaves the employee still has remaining.
Also, if you check on "leave request" and search for a certain person, the view is not permantent and the form gets reset every time you approve or disapprove a request.
Hi @borishinzer ,
Please check the latest commit for the solution to #47.
Please mention if requires any more updates on the same.
Users will now be able to see their current outstanding leaves and make the request directly from their profile view itself.
Also the admins can also see each employee leave details directly from the employee profile view, approve/cancel the requests.
With Regards,
Team Horilla
We tried to update horilla, but are now running into this error, when we try to open profiles:
`
OperationalError
at /employee/employee-profile
no such column: payroll_payslip.group_name
Request Method: | GET |
---|---|
https://horilla.web-vision.de/employee/employee-profile | |
4.2.3 | |
OperationalError | |
no such column: payroll_payslip.group_name | |
/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py, line 328, in execute | |
horilla.decorators.wrapped_view | |
/opt/horilla/horillaenv/bin/python | |
3.10.12 | |
['/opt/horilla/horilla', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/opt/horilla/horillaenv/lib/python3.10/site-packages'] |
`
We tried to fix it by running the commands here:
python manage.py migrate notifications zero
python manage.py makemigrations notifications
python manage.py migrate notifications
But this resulted in errors on the console:
/opt/horilla/horillaenv/bin/python manage.py makemigrations notifications
It is impossible to change a nullable field 'end_date' on period to non-nullable without providing a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.
3) Quit and manually define a default value in models.py.
Select an option: 1
Please enter the default value as valid Python.
The datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.
Type 'exit' to exit this prompt
>>> Job "leave_reset (trigger: interval[0:00:10], next run at: 2023-09-28 09:12:18 CEST)" raised an exception
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
sqlite3.OperationalError: no such column: leave_leavetype.require_attachment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/opt/horilla/horilla/leave/scheduler.py", line 15, in leave_reset
for leave_type in leave_types:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
django.db.utils.OperationalError: no such column: leave_leavetype.require_attachment
^CTraceback (most recent call last):
File "/opt/horilla/horilla/manage.py", line 22, in <module>
main()
File "/opt/horilla/horilla/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 233, in handle
changes = autodetector.changes(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/autodetector.py", line 46, in changes
changes = self._detect_changes(convert_apps, graph)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/autodetector.py", line 197, in _detect_changes
self.generate_altered_fields()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/autodetector.py", line 1198, in generate_altered_fields
new_default = self.questioner.ask_not_null_alteration(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/questioner.py", line 214, in ask_not_null_alteration
return self._ask_default()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/migrations/questioner.py", line 151, in _ask_default
code = input()
KeyboardInterrupt
Hi @borishinzer ,
Did you make the migrations first without clearing using the zero function?
python manage.py makemigrations
python manage.py migrate
If run the first command, this is the result:
/opt/horilla/horillaenv/bin/python manage.py makemigrations
It is impossible to change a nullable field 'end_date' on period to non-nullable without providing a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.
3) Quit and manually define a default value in models.py.
Select an option:
Hi @borishinzer ,
- Select the option "1".
- Add some random value there. (eg: test)
- Press enter
That did not work:
/opt/horilla/horillaenv/bin/python manage.py makemigrations
It is impossible to change a nullable field 'end_date' on period to non-nullable without providing a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.
3) Quit and manually define a default value in models.py.
Select an option: 1
Please enter the default value as valid Python.
The datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.
Type 'exit' to exit this prompt
>>> test
Invalid input: name 'test' is not defined
Please try with the value - timezone.now as the prompt answer
Please enter the default value as valid Python.
The datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.
Type 'exit' to exit this prompt
>>> timezone.now
It is impossible to change a nullable field 'start_date' on period to non-nullable without providing a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Ignore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.
3) Quit and manually define a default value in models.py.
Select an option: Job "leave_reset (trigger: interval[0:00:10], next run at: 2023-09-28 19:34:13 CEST)" raised an exception
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
sqlite3.OperationalError: no such column: leave_leavetype.require_attachment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/opt/horilla/horilla/leave/scheduler.py", line 15, in leave_reset
for leave_type in leave_types:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
django.db.utils.OperationalError: no such column: leave_leavetype.require_attachment
Job "leave_reset (trigger: interval[0:00:10], next run at: 2023-09-28 19:34:23 CEST)" raised an exception
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
sqlite3.OperationalError: no such column: leave_leavetype.require_attachment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/opt/horilla/horilla/leave/scheduler.py", line 15, in leave_reset
for leave_type in leave_types:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
django.db.utils.OperationalError: no such column: leave_leavetype.require_attachment
Job "leave_reset (trigger: interval[0:00:10], next run at: 2023-09-28 19:34:33 CEST)" raised an exception
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
sqlite3.OperationalError: no such column: leave_leavetype.require_attachment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/opt/horilla/horilla/leave/scheduler.py", line 15, in leave_reset
for leave_type in leave_types:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
return super().execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/horilla/horillaenv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
django.db.utils.OperationalError: no such column: leave_leavetype.require_attachment
Hi @borishinzer ,
Could you provide us with the latest migration file in leave module?
horilla>leave>migrations>latest_migration_file (file with 000%s.py)
cat 0003_alter_companyleave_based_on_week_and_more.py
# Generated by Django 4.2.3 on 2023-08-23 10:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('leave', '0002_availableleave_expired_date_and_more'),
]
operations = [
migrations.AlterField(
model_name='companyleave',
name='based_on_week',
field=models.CharField(blank=True, choices=[('0', 'First Week'), ('1', 'Second Week'), ('2', 'Third Week'), ('3', 'Fourth Week'), ('4', 'Fifth Week')], max_length=100, null=True),
),
migrations.AlterField(
model_name='companyleave',
name='based_on_week_day',
field=models.CharField(choices=[('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'), ('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'), ('6', 'Sunday')], max_length=100),
),
migrations.AlterField(
model_name='leavetype',
name='reset_weekend',
field=models.CharField(blank=True, choices=[('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'), ('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'), ('6', 'Sunday')], max_length=10, null=True),
),
]
HI @borishinzer ,
Could you please also provide us the other two migration files in the leave module?
cat 0001_initial.py
# Generated by Django 4.2.3 on 2023-07-25 11:16
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('employee', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Holiday',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=30)),
('start_date', models.DateField()),
('end_date', models.DateField(blank=True, null=True)),
('recurring', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='LeaveType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('icon', models.ImageField(blank=True, null=True, upload_to='leave/leave_icon')),
('name', models.CharField(max_length=30)),
('color', models.CharField(max_length=30, null=True)),
('payment', models.CharField(choices=[('paid', 'Paid'), ('unpaid', 'Unpaid')], default='unpaid', max_length=30)),
('count', models.IntegerField(default=1, null=True)),
('period_in', models.CharField(choices=[('day', 'Day'), ('month', 'Month'), ('year', 'Year')], default='day', max_length=30)),
('total_days', models.IntegerField(default=1, null=True)),
('reset', models.BooleanField(default=False)),
('reset_based', models.CharField(blank=True, choices=[('yearly', 'Yearly'), ('monthly', 'Monthly'), ('weekly', 'Weekly')], max_length=30, null=True)),
('reset_month', models.CharField(blank=True, choices=[('1', 'Jan'), ('2', 'Feb'), ('3', 'Mar'), ('4', 'Apr'), ('5', 'May'), ('6', 'Jun'), ('7', 'Jul'), ('8', 'Aug'), ('9', 'Sep'), ('10', 'Oct'), ('11', 'Nov'), ('12', 'Dec')], max_length=30)),
('reset_day', models.CharField(blank=True, choices=[('last day', 'Last Day'), ('1', '1st'), ('2', '2nd'), ('3', '3rd'), ('4', '4th'), ('5', '5th'), ('6', '6th'), ('7', '7th'), ('8', '8th'), ('9', '9th'), ('10', '10th'), ('11', '11th'), ('12', '12th'), ('13', '13th'), ('14', '14th'), ('15', '15th'), ('16', '16th'), ('17', '17th'), ('18', '18th'), ('19', '19th'), ('20', '20th'), ('21', '21th'), ('22', '22th'), ('23', '23th'), ('24', '24th'), ('25', '25th'), ('26', '26th'), ('27', '27th'), ('28', '28th'), ('29', '29th'), ('30', '30th'), ('31', '31th')], max_length=30, null=True)),
('reset_weekend', models.CharField(blank=True, choices=[('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'), ('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'), ('6', 'Sunday')], max_length=10, null=True)),
('carryforward_type', models.CharField(choices=[('no carryforward', 'No Carry Forward'), ('carryforward', 'Carry Forward'), ('carryforward expire', 'Carry Forward with Expire')], default='no carryforward', max_length=30)),
('carryforward_max', models.IntegerField(blank=True, null=True)),
('carryforward_expire_in', models.IntegerField(blank=True, null=True)),
('carryforward_expire_period', models.CharField(blank=True, choices=[('day', 'Day'), ('month', 'Month'), ('year', 'Year')], max_length=30, null=True)),
('require_approval', models.CharField(blank=True, choices=[('yes', 'Yes'), ('no', 'No')], max_length=30, null=True)),
('exclude_company_leave', models.CharField(choices=[('yes', 'Yes'), ('no', 'No')], max_length=30)),
('exclude_holiday', models.CharField(choices=[('yes', 'Yes'), ('no', 'No')], max_length=30)),
],
),
migrations.CreateModel(
name='LeaveRequest',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start_date', models.DateField()),
('start_date_breakdown', models.CharField(choices=[('full_day', 'Full Day'), ('first_half', 'First Half'), ('second_half', 'Second Half')], default='full_day', max_length=30)),
('end_date', models.DateField(blank=True, null=True)),
('end_date_breakdown', models.CharField(choices=[('full_day', 'Full Day'), ('first_half', 'First Half'), ('second_half', 'Second Half')], default='full_day', max_length=30)),
('requested_days', models.FloatField(blank=True, null=True)),
('requested_date', models.DateField(default=django.utils.timezone.now)),
('description', models.TextField()),
('attachment', models.FileField(blank=True, null=True, upload_to='leave/leave_attachment')),
('status', models.CharField(choices=[('requested', 'Requested'), ('approved', 'Approved'), ('cancelled', 'Cancelled')], default='requested', max_length=30)),
('approved_available_days', models.FloatField(default=0)),
('approved_carryforward_days', models.FloatField(default=0)),
('created_at', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='leave_request_created', to='employee.employee')),
('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='employee.employee')),
('leave_type_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='leave.leavetype')),
],
),
migrations.CreateModel(
name='CompanyLeave',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('based_on_week', models.CharField(blank=True, choices=[('0', 'First Week'), ('1', 'Second Week'), ('2', 'Third Week'), ('3', 'Fourth Week'), ('5', 'Fifth Week')], max_length=100, null=True)),
('based_on_week_day', models.CharField(choices=[('0', 'Monday'), ('1', 'Tuesday'), ('2', 'Wednesday'), ('3', 'Thursday'), ('4', 'Friday'), ('5', 'Saturday'), ('6', 'Sunday')], max_length=100)),
],
options={
'unique_together': {('based_on_week', 'based_on_week_day')},
},
),
migrations.CreateModel(
name='AvailableLeave',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('available_days', models.FloatField(default=0)),
('carryforward_days', models.FloatField(default=0)),
('total_leave_days', models.FloatField(default=0)),
('assigned_date', models.DateField(default=django.utils.timezone.now)),
('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='available_leave', to='employee.employee')),
('leave_type_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='employee_available_leave', to='leave.leavetype')),
],
options={
'unique_together': {('leave_type_id', 'employee_id')},
},
),
]
cat 0002_availableleave_expired_date_and_more.py
# Generated by Django 4.2.3 on 2023-08-08 13:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('leave', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='availableleave',
name='expired_date',
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
model_name='availableleave',
name='reset_date',
field=models.DateField(blank=True, null=True),
),
migrations.AlterField(
model_name='companyleave',
name='based_on_week_day',
field=models.CharField(choices=[('1', 'Monday'), ('2', 'Tuesday'), ('3', 'Wednesday'), ('4', 'Thursday'), ('5', 'Friday'), ('6', 'Saturday'), ('7', 'Sunday')], max_length=100),
),
migrations.AlterField(
model_name='leavetype',
name='reset_weekend',
field=models.CharField(blank=True, choices=[('1', 'Monday'), ('2', 'Tuesday'), ('3', 'Wednesday'), ('4', 'Thursday'), ('5', 'Friday'), ('6', 'Saturday'), ('7', 'Sunday')], max_length=10, null=True),
),
]
seems related to missing migrations, can be closed.
Hi @borishinzer ,
Okay.
Thanks for the update.