fix: 回退最后一次更新
This commit is contained in:
parent
58d5b06858
commit
bc8b6d8a7b
|
@ -1,20 +0,0 @@
|
|||
# Generated by Django 3.2.12 on 2023-11-17 06:12
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0024_auto_20231116_1416'),
|
||||
('hrm', '0015_clockrecord_note'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='clockrecord',
|
||||
name='shift',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='mtm.shift', verbose_name='班次'),
|
||||
),
|
||||
]
|
|
@ -109,8 +109,6 @@ class ClockRecord(BaseModel):
|
|||
employee = models.ForeignKey(
|
||||
Employee, verbose_name='对应人员', on_delete=models.CASCADE)
|
||||
clock_time = models.DateTimeField('打卡时间', null=True, blank=True)
|
||||
shift = models.ForeignKey('mtm.shift', verbose_name='班次',
|
||||
on_delete=models.SET_NULL, null=True, blank=True)
|
||||
# panel, location, door, manual
|
||||
trigger = models.CharField('触发', max_length=20)
|
||||
detail = models.JSONField('相关记录', default=dict,
|
||||
|
|
|
@ -221,7 +221,7 @@ class ClockRecordCreateSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = ClockRecord
|
||||
fields = ['id', 'type', 'employee', 'clock_time', 'shift']
|
||||
fields = ['id', 'type', 'employee', 'clock_time']
|
||||
|
||||
def validate(self, attrs):
|
||||
attrs['trigger'] = 'manual'
|
||||
|
|
|
@ -247,7 +247,8 @@ class ClockRecordViewSet(BulkCreateModelMixin, ListModelMixin, BulkDestroyModelM
|
|||
"""
|
||||
打卡记录
|
||||
"""
|
||||
perms_map = {'get': '*', 'post': '*'}
|
||||
perms_map = {'get': '*', 'post': 'clockrecord.create',
|
||||
'delete': 'clockrecord.delete'}
|
||||
queryset = ClockRecord.objects.all()
|
||||
select_related_fields = ['employee']
|
||||
search_fields = ['employee__name', 'employee__number', 'employee__phone']
|
||||
|
|
Loading…
Reference in New Issue