Merge branch 'dev' of gitee.com:jinan-pengyusen-data/gzth into dev_zhou
Signed-off-by: 李鹏宇 <9664676+pengyuthon@user.noreply.gitee.com>
This commit is contained in:
@@ -33,7 +33,7 @@ patch(ListController.prototype, {
|
||||
|
||||
onWillStart(async () => {
|
||||
const manager_data = await this.orm.call('ir.ui.view', 'get_manager_data', [this.env.config.viewId]);
|
||||
if (!Object.keys(manager_data).length) {
|
||||
if (!Object.keys(manager_data).length || !manager_data.columns) {
|
||||
this.ooManager.columns.forEach(val => {
|
||||
val.visibility = !!!val.column_invisible;
|
||||
})
|
||||
@@ -41,6 +41,7 @@ patch(ListController.prototype, {
|
||||
Object.assign(this.ooManager, manager_data);
|
||||
this.archInfo.advanced_filter = this.ooManager.filter;
|
||||
}
|
||||
this.ooManager.show = manager_data.show;
|
||||
})
|
||||
|
||||
usePosition('ooListRef', () => this.ooManagerRef.el, {
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
'wizard/attendance_correct_wizard.xml',
|
||||
'wizard/yuthon_run_wizard.xml',
|
||||
'views/applet_address_views.xml',
|
||||
'views/applet_security_views.xml',
|
||||
'views/all_attendance_menu.xml',
|
||||
],
|
||||
'assets': {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from odoo import models, fields, api, http, SUPERUSER_ID, _
|
||||
import logging
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -29,14 +30,34 @@ class AppletSecurity(models.Model):
|
||||
_name = 'applet.security'
|
||||
_description = "小程序权限管理"
|
||||
|
||||
employee_id = fields.Char(string="员工")
|
||||
attendance_card = fields.Boolean(string="出勤打卡")
|
||||
hydropower = fields.Boolean(string="水电抄表")
|
||||
main_menu = fields.Selection([('att', '打卡'), ('hydropower', '水电')], string="首页")
|
||||
employee_id = fields.Many2one('hr.employee', string="员工")
|
||||
company_id = fields.Many2one(related="employee_id.company_id", string="公司")
|
||||
department_id = fields.Many2one(related="employee_id.department_id", string="部门")
|
||||
applet_security_setting_ids = fields.Many2many('applet.security.setting', string="权限板块")
|
||||
|
||||
def init_applet_security(self):
|
||||
"""
|
||||
初始化权限
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
employees = self.env['hr.employee'].search([])
|
||||
existing_records = self.search([])
|
||||
existing_employee_ids = existing_records.mapped('employee_id.id')
|
||||
clock_in_setting = self.env['applet.security.setting'].search([('name', '=', '打卡')], limit=1)
|
||||
if not clock_in_setting:
|
||||
raise UserError('请添加打卡板块')
|
||||
for employee in employees:
|
||||
if employee.id in existing_employee_ids:
|
||||
existing_records.filtered(lambda r: r.employee_id.id == employee.id)
|
||||
else:
|
||||
self.create({
|
||||
'employee_id': employee.id,
|
||||
# 'applet_security_setting_ids': [(6, 0, [])]
|
||||
'applet_security_setting_ids': [(4, clock_in_setting.id)],
|
||||
})
|
||||
|
||||
|
||||
class AppletSecuritySeeting(models.Model):
|
||||
_name = 'applet.security.setting'
|
||||
|
||||
name = fields.Char(string="板块名称")
|
||||
@@ -48,8 +48,8 @@ class AppletAttendance(Controller):
|
||||
user_id = request.env(user=SUPERUSER_ID)["res.users"].search([('id', '=', int(kw['user_id']))])
|
||||
employee_id = request.env(user=SUPERUSER_ID)["hr.employee"].search([('name', '=', user_id.name)])
|
||||
attendance_id = request.env(user=SUPERUSER_ID)["hr.attendance"].search([('employee_id', '=', employee_id.id), ('current_data', '=', current_data)])
|
||||
check_in = attendance_id.check_in + timedelta(hours=8)
|
||||
check_out = attendance_id.check_out + timedelta(hours=8)
|
||||
check_in = attendance_id.check_in + timedelta(hours=8) if attendance_id.check_in else ''
|
||||
check_out = attendance_id.check_out + timedelta(hours=8) if attendance_id.check_out else ''
|
||||
check_in_start = attendance_id.shift_id.template_id.check_in_start
|
||||
check_out_end = attendance_id.shift_id.template_id.check_out_end
|
||||
start_minute = int((check_in_start - int(check_in_start)) * 60)
|
||||
@@ -204,7 +204,7 @@ class AppletAttendance(Controller):
|
||||
# calendar_leaves = request.env(user=SUPERUSER_ID)['resource.calendar.leaves'].search(
|
||||
# [("calendar_id", "=", "行政考勤工作日")]) # 少一个search
|
||||
# 本月的节假日
|
||||
holiday_data = self.get_holiday_data(current_month_first.date(), current_month_last.date())
|
||||
# holiday_data = self.get_holiday_data(current_month_first.date(), current_month_last.date())
|
||||
# 本月考勤记录
|
||||
leave_days = 0
|
||||
current_attendance = request.env(user=SUPERUSER_ID)['hr.attendance'].sudo().search([
|
||||
@@ -219,7 +219,7 @@ class AppletAttendance(Controller):
|
||||
('date_from', '>=', current_month_first),
|
||||
('date_to', '<=', current_month_last),
|
||||
('state', 'in', ['confirm', 'validate1'])
|
||||
])
|
||||
])
|
||||
for leave in leave_ids:
|
||||
leave_days += leave.number_of_days,
|
||||
|
||||
@@ -238,7 +238,8 @@ class AppletAttendance(Controller):
|
||||
'message': 'OK',
|
||||
'data': {
|
||||
'current_month': {
|
||||
'holiday_data': holiday_data,
|
||||
# 'holiday_data': holiday_data,
|
||||
'holiday_data': {"holiday_list": [], "shift_days_list": []},
|
||||
'banner_rote': current_stats,
|
||||
'attendance_data': current_records,
|
||||
},
|
||||
@@ -270,8 +271,10 @@ class AppletAttendance(Controller):
|
||||
check_out_status = '缺卡' if not check_out else ('早退' if is_early_card else '正常')
|
||||
check_in_str = (check_in + timedelta(hours=8)).strftime('%H:%M:%S') if check_in else '缺卡'
|
||||
check_out_str = (check_out + timedelta(hours=8)).strftime('%H:%M:%S') if check_out else '缺卡'
|
||||
check_in_html = f'<p style="color:red">{check_in_status}</p>' if check_in_status in ['迟到', '早退', '缺卡'] else f'<p style="color:green">{check_in_status}</p>'
|
||||
check_out_html = f'<p style="color:red">{check_out_status}</p>' if check_out_status in ['迟到', '早退','缺卡'] else f'<p style="color:green">{check_out_status}</p>'
|
||||
check_in_html = f'<p style="color:red">{check_in_status}</p>' if check_in_status in ['迟到', '早退',
|
||||
'缺卡'] else f'<p style="color:green">{check_in_status}</p>'
|
||||
check_out_html = f'<p style="color:red">{check_out_status}</p>' if check_out_status in ['迟到', '早退',
|
||||
'缺卡'] else f'<p style="color:green">{check_out_status}</p>'
|
||||
# 添加到记录列表
|
||||
records.append({
|
||||
'date': att.current_data.strftime('%Y-%m-%d'),
|
||||
@@ -301,7 +304,7 @@ class AppletAttendance(Controller):
|
||||
# 将date对象转换为datetime对象
|
||||
start_datetime = datetime.combine(start_date, datetime.min.time())
|
||||
end_datetime = datetime.combine(end_date, datetime.max.time())
|
||||
domain.extend([("date_from", "<=", end_datetime),("date_to", ">=", start_datetime)])
|
||||
domain.extend([("date_from", "<=", end_datetime), ("date_to", ">=", start_datetime)])
|
||||
calendar_leaves = request.env(user=SUPERUSER_ID)['resource.calendar.leaves'].search(domain)
|
||||
# 根据name 来进行去重
|
||||
unique_leaves = {}
|
||||
|
||||
@@ -58,3 +58,4 @@ access_yuthon_integrated_wizard,yuthon.integrated.wizard,model_yuthon_integrated
|
||||
|
||||
access_applet_address,applet.address,model_applet_address,base.group_user,1,1,1,1
|
||||
access_applet_security,applet.security,model_applet_security,base.group_user,1,1,1,1
|
||||
access_applet_security_setting,applet.security.setting,model_applet_security_setting,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -14,17 +14,49 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="applet_address_action" model="ir.actions.act_window">
|
||||
<field name="name">小程序地址管理</field>
|
||||
<field name="res_model">applet.address</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
<record id="applet_address_write_resource_department" model="ir.actions.server">
|
||||
<field name="name">更新员工</field>
|
||||
<field name="model_id" ref="yuthon_hr_attendance.model_applet_address"/>
|
||||
<field name="binding_model_id" ref="yuthon_hr_attendance.model_applet_address"/>
|
||||
|
||||
<record id="applet_security_tree" model="ir.ui.view">
|
||||
<field name="name">applet.security.tree</field>
|
||||
<field name="model">applet.security</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="company_id"/>
|
||||
<field name="applet_security_setting_ids" widget="many2many_tags"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="applet_security_action" model="ir.actions.act_window">
|
||||
<field name="name">员工小程序权限管理</field>
|
||||
<field name="res_model">applet.security</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
<record id="applet_security_server" model="ir.actions.server">
|
||||
<field name="name">初始化员工</field>
|
||||
<field name="model_id" ref="yuthon_hr_attendance.model_applet_security"/>
|
||||
<field name="binding_model_id" ref="yuthon_hr_attendance.model_applet_security"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.update_employee()</field>
|
||||
<field name="code">action = model.init_applet_security()</field>
|
||||
</record>
|
||||
|
||||
<record id="applet_security_setting_tree" model="ir.ui.view">
|
||||
<field name="name">applet.security.setting.tree</field>
|
||||
<field name="model">applet.security.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="applet_security_setting_action" model="ir.actions.act_window">
|
||||
<field name="name">小程序权限配置</field>
|
||||
<field name="res_model">applet.security.setting</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="applet_security_tree" model="ir.ui.view">
|
||||
<field name="name">applet.security.tree</field>
|
||||
<field name="model">applet.security</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="employee_id"/>
|
||||
<field name="attendance_card"/>
|
||||
<field name="hydropower"/>
|
||||
<field name="main_menu"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="applet_security_action" model="ir.actions.act_window">
|
||||
<field name="name">小程序权限管理</field>
|
||||
<field name="res_model">applet.security</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -70,7 +70,7 @@
|
||||
<field name="is_approval" optional="hidden"/>
|
||||
<field name="is_month" optional="hidden"/>
|
||||
<field name="is_last_month" optional="hidden"/>
|
||||
<field name="is_check_in_red" column_invisible="1"/>
|
||||
<field name="is_check_in_red" column_invisible="1"/>
|
||||
<field name="is_check_out_red" column_invisible="1"/>
|
||||
<button name="button_controls_wizard" type="object" string="操作" class="oe_highlight" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)"/>
|
||||
<button name="button_correct_wizard" type="object" string="修正" class="btn btn-primary" invisible="not (is_abnormal or is_early_card or is_late_card or absenteeism_card or is_no_card)" groups="yuthon_hr_attendance.group_he_attendance_sign_manager"/>
|
||||
|
||||
@@ -129,6 +129,11 @@ class InheritHrPayslip(models.Model):
|
||||
retroactive_insurance = fields.Float(string='补扣保险')
|
||||
distribution_part = fields.Float(string='扣除环境作业津贴多发放部分')
|
||||
|
||||
# 三家公司
|
||||
add_year_float = fields.Float(string='补年金差额')
|
||||
minus_year_float = fields.Float(string='扣年金差额')
|
||||
|
||||
|
||||
performance_deduction = fields.Float(string='扣发绩效奖金', compute='_compute_deduction', store=True)
|
||||
commuting_deduction = fields.Float(string='扣发通信补贴', compute='_compute_deduction', store=True)
|
||||
base_salary_deduction = fields.Float(string='扣发基本工资', compute='_compute_deduction', store=True)
|
||||
@@ -353,10 +358,16 @@ class InheritHrPayslip(models.Model):
|
||||
record.duty +
|
||||
record.monthly_overtime +
|
||||
record.annuity +
|
||||
|
||||
record.add_year_float +
|
||||
|
||||
# 新增的物管临时项
|
||||
record.excellent_employees +
|
||||
record.leave_absence -
|
||||
# 扣除项
|
||||
|
||||
record.minus_year_float -
|
||||
|
||||
record.performance_deduction -
|
||||
record.commuting_deduction -
|
||||
record.base_salary_deduction -
|
||||
|
||||
@@ -287,6 +287,10 @@
|
||||
<field name="year_compute" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
<field name="year_jie" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
<field name="leave_absence" decoration-danger="1" optional="show" groups="yuthon_salary.group_wg_user"/>
|
||||
|
||||
<field name="add_year_float" decoration-danger="1" optional="show"/>
|
||||
<field name="minus_year_float" decoration-danger="1" optional="show"/>
|
||||
|
||||
<field name="performance_up" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
<field name="jing_te" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
<field name="year_gong" decoration-danger="1" optional="show" groups="yuthon_salary.group_jtbb_user"/>
|
||||
|
||||
@@ -174,6 +174,16 @@
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="18"
|
||||
action="yuthon_hr_attendance.applet_address_action"/>
|
||||
<menuitem id="applet_security_board"
|
||||
name="员工小程序权限管理"
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="19"
|
||||
action="yuthon_hr_attendance.applet_security_action"/>
|
||||
<menuitem id="applet_security_setting_board"
|
||||
name="小程序权限配置"
|
||||
parent="hr_attendance_root_board_menu"
|
||||
sequence="20"
|
||||
action="yuthon_hr_attendance.applet_security_setting_action"/>
|
||||
<!-- <menuitem id="menu_applet_security_board"-->
|
||||
<!-- name="小程序权限管理"-->
|
||||
<!-- parent="hr_attendance_root_board_menu"-->
|
||||
|
||||
Reference in New Issue
Block a user