This commit is contained in:
李鹏宇
2026-01-21 18:48:20 +08:00
14 changed files with 97 additions and 75 deletions
@@ -452,7 +452,7 @@ class SoongWorkflowMixin(models.AbstractModel):
# 筛选与当前节点部门匹配的后续节点
valid_nodes = []
for link in current_node.out_link_ids:
if self.name_title in ['业务审批', '会审意见表', '信息发布申请表',]:
if self.name_title in ['业务审批', '汇审意见表', '信息发布申请表',]:
category_names = self.information_categories_ids.mapped('name')
target_name = link.name.split('->')[-1].strip()
if '工会活动' in category_names:
@@ -91,6 +91,7 @@ class AppletAttendance(Controller):
}
"""
_logger.info("----------------/yuthon/att/today---------接口收到响应-------------------------------")
_logger.info(f'{kw}---wifi可以打卡----------')
current_datetime = fields.Datetime.now() + timedelta(hours=8)
current_date = fields.Date.today() + timedelta(hours=8)
@@ -98,7 +98,9 @@ class HrAttendanceDetail(models.Model):
def create(self, vals):
record = super(HrAttendanceDetail, self).create(vals)
if record.employee_id.name != '龙春球':
if record.employee_id and record.checkin_time and record.source == 'iot':
resource_user_ids = record.employee_id.resource_calendar_id.resource_user_ids.ids
is_resource_user = True if record.employee_id.id in resource_user_ids else False
if record.employee_id and record.checkin_time and record.source == 'iot' and not is_resource_user:
employee_id = record.employee_id
checkin_datetime = record.checkin_time
current_data = record.checkin_time.date() + timedelta(hours=8)
@@ -508,14 +508,20 @@ class YuthonVacationReports(models.Model):
}
}
def all_put(self):
vacation_ids = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id')))
vacation_list = []
for rec in vacation_ids:
vacation_list.append(rec.id)
return {
'type': 'ir.actions.act_window',
'name': '批量发送确认弹窗',
'res_model': 'vacation.put.wizard',
'view_mode': 'form',
'target': 'new',
'context': {'default_vacation_ids': [(6, 0, [vacation_list])]
}
}
@@ -724,7 +730,6 @@ class YuthonVacationReports(models.Model):
record.statutory_leave = legal_total/8
record.cop_leave = total_add2 / 8
@api.depends('meal_fee_ids.update_lines', 'meal_fee_ids.update_type', 'meal_fee_ids.is_void')
def _compute_meal_fee(self):
for record in self:
@@ -738,14 +743,34 @@ class YuthonVacationReports(models.Model):
record.meal_fee = meal_total
def all_confirm(self):
vacation_ids = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id')))
vacation_list = []
for rec in vacation_ids:
vacation_list.append(rec.id)
return {
'name': '批量确认弹窗',
'type': 'ir.actions.act_window',
'res_model': 'vacation.confirm.wizard',
'view_mode': 'form',
'target': 'new',
'name': '批量确认弹窗',
'type': 'ir.actions.act_window',
'res_model': 'vacation.confirm.wizard',
'view_mode': 'form',
'target': 'new',
'context': {'default_vacation_ids': [(6, 0, vacation_list)]},
}
}
def all_carryover(self):
vacation_ids = self.env["yuthon.vacation.reports"].browse(
self._context.get('active_ids', self._context.get('active_id')))
vacation_list = []
for rec in vacation_ids:
vacation_list.append(rec.id)
return {
'name': '加班结转',
'type': 'ir.actions.act_window',
'res_model': 'pay.carryover.wizard',
'view_mode': 'form',
'target': 'new',
'context': {'default_vacation_ids': [(6, 0, vacation_list)]},
}
# 自动确认考勤台账(上个月)
def automatic_confirmation(self):
@@ -1330,6 +1355,8 @@ class VacationOtherLine(models.Model):
'view_mode': 'form',
}
class AttendanceMessageLog(models.Model):
_name = 'attendance.message.log'
_description = '消息提醒日志'
@@ -6,43 +6,43 @@ import { listView } from '@web/views/list/list_view';
export class CustomAttendanceVacationPutController extends ListController {
setup() {
super.setup();
}
openVacationPutWizard() {
}
openHrLeaveWizard() {
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'vacation.put.wizard',
name: '批量发送确认弹窗',
view_mode: 'form',
res_model: 'hr.leave',
name: '请假情况',
view_mode: 'tree',
view_type: 'form',
views: [[false, 'form']],
target: 'new', // 以弹窗形式打开
views: [["yuthon_hr_attendance.view_hr_leave_statement_tree", 'tree']],
target: 'new', // 弹窗形式打开
context: {},
});
}
openVacationConfirmWizard(){
openVacationOverWizard() {
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'vacation.confirm.wizard',
name: '批量确认弹窗',
view_mode: 'form',
res_model: 'vacation.over.line',
name: '加班情况',
view_mode: 'tree',
view_type: 'form',
views: [[false, 'form']],
target: 'new', // 以弹窗形式打开
views: [[false, 'tree']],
target: 'new',
context: {},
});
}
openPayCarryoverWizard(){
openYuthonVacationWizard() {
this.actionService.doAction({
type: 'ir.actions.act_window',
res_model: 'pay.carryover.wizard',
name: '加班费结转弹窗',
view_mode: 'form',
res_model: 'yuthon.vacation.reports',
name: '误餐情况',
view_mode: 'tree',
view_type: 'form',
views: [[false, 'form']],
target: 'new', // 以弹窗形式打开
views: [[false, 'tree']],
target: 'new',
context: {},
});
}
@@ -2,18 +2,18 @@
<templates>
<t t-name="vacation_put_module.ListView.Buttons" t-inherit="web.ListView.Buttons">
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openVacationConfirmWizard">
批量确认
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openHrLeaveWizard">
请假情况
</button>
</xpath>
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openVacationPutWizard">
批量发送
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openVacationOverWizard">
加班情况
</button>
</xpath>
<xpath expr="//div[hasclass('o_list_buttons')]" position="after">
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openPayCarryoverWizard">
加班费结算
<button type="button" class="btn btn-primary" style="margin-left: 10px;" t-on-click="openYuthonVacationWizard">
误餐情况
</button>
</xpath>
</t>
@@ -605,6 +605,27 @@
<field name="state">code</field>
<field name="code">action = model.vacation_delete()</field>
</record>
<record id="all_put" model="ir.actions.server">
<field name="name">发送确认提醒</field>
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="binding_model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.all_put()</field>
</record>
<record id="all_confirm" model="ir.actions.server">
<field name="name">批量确认</field>
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="binding_model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.all_confirm()</field>
</record>
<record id="all_carryover" model="ir.actions.server">
<field name="name">加班费结转</field>
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="binding_model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">action = model.all_carryover()</field>
</record>
<record id="all_manage_confirmation" model="ir.actions.server">
<field name="name">管理员确认</field>
<field name="model_id" ref="yuthon_hr_attendance.model_yuthon_vacation_reports"/>
@@ -15,23 +15,11 @@ class PayCarryoverWizard(models.TransientModel):
_name = 'pay.carryover.wizard'
_description = '加班费结转'
select_time = fields.Selection([('1', '一月'), ('2', '二月'), ('3', '三月'), ('4', '四月'),
('5', '五月'), ('6', '六月'), ('7', '七月'), ('8', '八月'),
('9', '九月'), ('10', '十月'), ('11', '十一月'),
('12', '十二月')], string='选择月份',
default=lambda self: self._get_default_month())
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='选择年份',
default=lambda self: str(datetime.now().year))
vacation_ids = fields.Many2many('yuthon.vacation.reports', string='假期')
def action_confirm(self):
year = int(self.select_year)
month = int(self.select_time)
vacation_date = datetime(year, month, 1).date()
reports = self.env["yuthon.vacation.reports"].search([('vacation_date', '=', vacation_date),
('company_id.name', '=', '集团本部')
])
is_2025_december = (year == 2026 and month == 1)
for rec in reports:
for rec in self.vacation_ids:
is_2025_december = rec.vacation_date.year == 2026 and rec.vacation_date.month == 1
if rec.overtime_ids:
for overtime in rec.overtime_ids:
if overtime.text == '上月额度继承' and overtime.workday > 40:
@@ -6,8 +6,7 @@
<field name="arch" type="xml">
<form string="加班费结转">
<group>
<field name="select_year"/>
<field name="select_time"/>
<field name="vacation_ids" invisible="1"/>
</group>
<footer>
<button string="确定" name="action_confirm" type="object" class="btn-primary"/>
@@ -15,15 +15,9 @@ class VacationConfirmWizard(models.TransientModel):
_name = 'vacation.confirm.wizard'
_description = '批量确认弹窗'
company_id = fields.Many2one('res.company', string='公司', default=lambda self: self.env.user.company_id)
vacation_ids = fields.Many2many('yuthon.vacation.reports', string='假期')
def action_confirm(self):
today = date.today()
vacation_date = (today - relativedelta(months=1)).replace(day=1)
reports = self.env["yuthon.vacation.reports"].search([('vacation_state', '=', 'pending'),
('vacation_date', '=', vacation_date),
('company_id', '=', self.company_id.id)
])
for rec in reports:
for rec in self.vacation_ids:
rec.vacation_state = 'pending'
rec.automatic_confirmation()
@@ -9,7 +9,7 @@
确认要批量确认吗?
</div>
<group>
<field name="company_id" invisible="1"/>
<field name="vacation_ids" invisible="1"/>
</group>
<footer>
<button string="确定" name="action_confirm" type="object" class="btn-primary"/>
@@ -13,21 +13,11 @@ class VacationPutWizard(models.TransientModel):
_name = 'vacation.put.wizard'
_description = '批量发送弹窗'
company_id = fields.Many2one('res.company', string='公司', default=lambda self: self.env.user.company_id.id)
vacation_ids = fields.Many2many('yuthon.vacation.reports', string='假期')
def action_confirm(self):
today = date.today()
vacation_date = (today - relativedelta(months=1)).replace(day=1)
reports = self.env["yuthon.vacation.reports"].search([('vacation_state', '=', 'not_sent'),
('company_id', '=', self.company_id.id),
('vacation_date', '=', vacation_date)
])
if not reports:
return
# 按员工分组,仅保留每个员工vacation_date最新的记录
employee_reports_map = {}
for report in reports:
for report in self.vacation_ids:
if not report.employee_id:
continue
emp = report.employee_id
@@ -9,7 +9,7 @@
只针对未确认的考勤确认单台账,确定要发送吗?
</div>
<group>
<field name="company_id" invisible="1"/>
<field name="vacation_ids" invisible="1"/>
</group>
<footer>
<button string="确定" name="action_confirm" type="object" class="btn-primary"/>
+1 -1
View File
@@ -100,7 +100,7 @@ class YuthonNotice(http.Controller):
def yuthon_notice_confirm(self, **kwargs):
notice_id = kwargs.get('id')
employee_id = kwargs.get('employee_id')
confirm_id = request.env['yuthon.confirm.users'].sudo().search([('notice_id', '=', notice_id),('employee_id', '=', employee_id)])
confirm_id = request.env['yuthon.confirm.users'].sudo().search([('notice_id', '=', notice_id), ('employee_id', '=', employee_id)])
confirm_id.write({'state': 'yes'})
return json.dumps({'code': 200, 'message': 'OK'})