fix egister Attendance
This commit is contained in:
parent
d614137b51
commit
5a9efd52d8
|
|
@ -1708,8 +1708,8 @@ msgstr "للأسف. لايمكن إنشاء تسجيل حضور وإنصراف
|
|||
#. module: attendances
|
||||
#: code:addons/attendances/models/hr_attendance_register.py:0
|
||||
#, python-format
|
||||
msgid "You can not Register Attendance Before Tow Days"
|
||||
msgstr "للأسف. لايمكن إنشاء تسجيل حضور وإنصراف قبل يومين"
|
||||
msgid "Sorry, You can not Register Attendance Before %s Days."
|
||||
msgstr "للأسف, لايمكن إنشاء تسجيل حضور وإنصراف قبل %s يوم."
|
||||
|
||||
#. module: attendances
|
||||
#: code:addons/attendances/models/hr_attendance_register.py:0
|
||||
|
|
@ -2120,3 +2120,13 @@ msgstr "المدير المباشر"
|
|||
msgid "HR Manager"
|
||||
msgstr "مدير الموارد البشرية"
|
||||
|
||||
#. module: attendances
|
||||
#: model:ir.model.fields,field_description:attendances.field_resource_calendar__register_before
|
||||
msgid "Attendance Register Before"
|
||||
msgstr "تسجيل الحضور قبل"
|
||||
|
||||
#. module: attendances
|
||||
#: model:ir.model.fields,help:attendances.field_resource_calendar__register_before
|
||||
msgid "The Maximum Number of Days to Request Missing Attendance"
|
||||
msgstr "الحد الأقصى لعدد الأيام لطلب تسجيل بصمة مفقوده"
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ class HrAttendances(models.Model):
|
|||
'resource.calendar.attendance', 'calendar_id', 'Working Time',
|
||||
copy=True, default=_get_default_attendance_ids)
|
||||
|
||||
register_before = fields.Integer(string='Attendance Register Before', help="The Maximum Number of Days to Request Missing Attendance")
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
if args is None: args = []
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class HrAttendanceRegister(models.Model):
|
|||
for item in self:
|
||||
today = fields.Date.from_string(fields.Date.today())
|
||||
datee = item.action_date
|
||||
max_days = item.employee_id.resource_calendar_id.register_before
|
||||
if datee:
|
||||
attendance_date = datetime.strptime(str(datee), "%Y-%m-%d %H:%M:%S")
|
||||
currnt_hour = datetime.now().hour + 3
|
||||
|
|
@ -47,8 +48,8 @@ class HrAttendanceRegister(models.Model):
|
|||
|
||||
currnt_date = datetime.strptime(str(datee), '%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d')
|
||||
deff_days = (today - fields.Date.from_string(currnt_date)).days
|
||||
if deff_days > 2:
|
||||
raise exceptions.Warning(_('You can not Register Attendance Before Tow Days'))
|
||||
if deff_days > max_days:
|
||||
raise exceptions.Warning(_('Sorry, You can not Register Attendance Before %s Days.')% max_days)
|
||||
if deff_days < 0:
|
||||
raise exceptions.Warning(_('You can not Register Attendance After Today'))
|
||||
# item.date = currnt_date
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
<field name="is_flexible" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="noke" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="active"/>
|
||||
<field name="register_before"/>
|
||||
</group>
|
||||
<group string="Sign In Period" attrs="{'invisible':[('is_full_day','=',False)]}" colspan="2">
|
||||
<field name="full_min_sign_in" widget="float_time"
|
||||
|
|
|
|||
Loading…
Reference in New Issue