Accept Merge Request #266: (feature/创建工作日历代码测试 -> develop)

Merge Request: 新增工作日历设置的日志   

Created By: @禹翔辉
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/266?initial=true
This commit is contained in:
禹翔辉
2023-07-18 14:37:03 +08:00

View File

@@ -137,12 +137,14 @@ class WorkLogSetting(models.Model):
# end_date = start_date + timedelta(days=365) # 结束日期
# 获取本年第一天和最后一天
start_date = datetime.now().replace(month=1, day=1).date()
end_date = datetime.now().replace(month=12, day=31).date()
end_date = datetime.now().replace(month=1, day=31).date()
logging.info(f'start_date: {start_date} , end_date: {end_date}')
# 休息日列表
rest_days = self.day_off_ids.mapped('name')
logging.info(f'获取界面输入的休息日:{rest_days}')
for single_date in self.daterange(start_date, end_date):
is_workday = single_date.strftime("%A")
logging.info(f'获取一月份每天的星期:{is_workday}')
if is_workday in rest_days:
print('is_workday in rest_days', is_workday)
self.env['sf.work.schedule.calendar'].sudo().create({