This commit is contained in:
李鹏宇
2024-07-18 17:34:00 +08:00
parent 83ba94a562
commit 2baa5bb168
10 changed files with 72 additions and 21 deletions
@@ -6,7 +6,7 @@ from datetime import datetime, time, timedelta
class OvertimeApprovals(models.Model):
_name = 'overtime.approval'
_description = "加班审批"
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin']
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
_rec_name = 'name'
name = fields.Char(string="名称", default="加班申请")
@@ -20,11 +20,11 @@
<field name="model">overtime.approval</field>
<field name="arch" type="xml">
<form>
<header>
<widget name="attach_document" string="附加文档" action="message_post"/>
<button name="go_overtime_approval" string="发起申请" type="object" class="oe_highlight"/>
<field name="statu" widget="statusbar"/>
</header>
<!-- <header>-->
<!-- <widget name="attach_document" string="附加文档" action="message_post"/>-->
<!-- <button name="go_overtime_approval" string="发起申请" type="object" class="oe_highlight"/>-->
<!-- <field name="statu" widget="statusbar"/>-->
<!-- </header>-->
<sheet>
<div class="oe_title">
<label for="name"/>
Binary file not shown.
@@ -7,7 +7,7 @@
<field name="arch" type="xml">
<!-- 源码的信息暂时隐藏 -->
<xpath expr="//field[@name='parent_id']" position="attributes">
<attribute name="invisible">1</attribute>
<attribute name="string">上级领导</attribute>
</xpath>
<xpath expr="//field[@name='coach_id']" position="attributes">
<attribute name="invisible">1</attribute>
@@ -163,6 +163,26 @@
</field>
</record>
<record id="view_employee_inherit_del_tree" model="ir.ui.view">
<field name="name">hr.employee.inherit.del.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='activity_ids']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='activity_date_deadline']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='parent_id']" position="attributes">
<attribute name="string">上级领导</attribute>
</xpath>
<xpath expr="//field[@name='work_email']" position="after">
<field name="user_role_id"/>
</xpath>
</field>
</record>
<record id="all_data_write_user" model="ir.actions.server">
<field name="name">批量更新员工</field>
<field name="model_id" ref="hr.model_hr_employee"/>
@@ -35,7 +35,23 @@ class YuthonHrEmployeeWizard(models.Model):
def employee_user_data(self, row):
employee_name = self.env['hr.employee'].search([('name', '=', row[0].value)])
department_id = self.env['hr.department'].search([('name', '=', row[1].value.split('\\')[-1])])
role_data = row[4].value
role_main = self.env['yuthon.user.role'].search([('name', '=', row[4].value)])
job = self.env['hr.job'].search([('name', '=', row[7].value)])
job_lv = self.env['yuthon.job.lv'].search([('name', '=', row[8].value)])
parent_id = self.env['hr.employee'].search([('name', '=', row[9].value)])
if role_main:
role_list_id = role_main
else:
role_list_id = self.env['yuthon.user.role'].create({'name': row[4].value})
if job:
job_id = job
else:
job_id = self.env['hr.job'].create({'name': row[7].value})
if job_lv:
job_lv_id = job_lv
else:
job_lv_id = self.env['yuthon.job.lv'].create({'name': row[8].value})
role_data = row[5].value
role_list_ids = []
for user in role_data.split(','):
user_role = self.env['yuthon.user.role'].search([('name', '=', user)])
@@ -49,10 +65,12 @@ class YuthonHrEmployeeWizard(models.Model):
'department_id': department_id.id,
'user_sex': 'boy' if row[2].value == '男' else 'girl',
'birthday': datetime.strptime(row[3].value, '%Y-%m-%d').date() if len(row[3].value) != 0 else '',
'user_role_id': role_list_id,
'user_role_ids': role_list_ids,
'mobile_phone': row[5].value,
'work_phone': row[6].value,
'job_id': job_id,
'job_lv_id': job_lv_id,
'parent_id': parent_id,
}
if employee_name:
employee_name.write(employee_data)
else:
raise UserError('没有找到该员工%s,请检查用户信息' % (employee_name.name))
@@ -1,14 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_employee_wizard_form" model="ir.ui.view">
<record id="user_template_downloads_tian_he_action" model="ir.actions.act_url">
<field name="name">员工模板 下载</field>
<field name="target">self</field>
<field name="url">/yuthon_hr_employee/static/others/user_template.xlsx</field>
</record>
<record id="hr_employee_wizard_form" model="ir.ui.view">
<field name="name">审批意见弹窗</field>
<field name="model">yuthon.hr.employee.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<field name="excel_file" filename="excel_name"/>
<field name="excel_name" invisible="1"/>
</group>
<sheet>
<header>
<button name="%(user_template_downloads_tian_he_action)d" string="模板下载" type="action"
class="btn btn-primary"/>
</header>
<group>
<group>
<field name="excel_file" filename="excel_name"/>
<field name="excel_name" invisible="1"/>
</group>
<group>
</group>
</group>
</sheet>
<footer>
<button name="confirm" string="确认" type="object" class="oe_highlight"/>
<button string="返回" class="btn-secondary" special="cancel"/>
@@ -1 +0,0 @@
<svg width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M28 16c0 5.523-4.477 10-10 10S8 21.523 8 16 12.477 6 18 6s10 4.477 10 10Z" fill="#1AD3BB"/><path d="M43 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Zm-27 7h26a4 4 0 0 1 4 4v5a4 4 0 0 1-4 4H16V31Z" fill="#005E7A"/><path d="M4 31h16c7.18 0 13 5.82 13 13H17C9.82 44 4 38.18 4 31Z" fill="#1AD3BB"/><path d="M23.549 12.128 22.425 11l-5.532 5.556-3.319-3.335-1.123 1.129a1.552 1.552 0 0 0 0 2.188L16.892 21l6.657-6.685a1.55 1.55 0 0 0 0-2.187Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 539 B

-1
View File
@@ -1 +0,0 @@
<svg width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M28 16c0 5.523-4.477 10-10 10S8 21.523 8 16 12.477 6 18 6s10 4.477 10 10Z" fill="#1AD3BB"/><path d="M43 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Zm-27 7h26a4 4 0 0 1 4 4v5a4 4 0 0 1-4 4H16V31Z" fill="#005E7A"/><path d="M4 31h16c7.18 0 13 5.82 13 13H17C9.82 44 4 38.18 4 31Z" fill="#1AD3BB"/><path d="M23.549 12.128 22.425 11l-5.532 5.556-3.319-3.335-1.123 1.129a1.552 1.552 0 0 0 0 2.188L16.892 21l6.657-6.685a1.55 1.55 0 0 0 0-2.187Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 539 B

@@ -1 +0,0 @@
<svg width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M28 16c0 5.523-4.477 10-10 10S8 21.523 8 16 12.477 6 18 6s10 4.477 10 10Z" fill="#1AD3BB"/><path d="M43 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Zm-27 7h26a4 4 0 0 1 4 4v5a4 4 0 0 1-4 4H16V31Z" fill="#005E7A"/><path d="M4 31h16c7.18 0 13 5.82 13 13H17C9.82 44 4 38.18 4 31Z" fill="#1AD3BB"/><path d="M23.549 12.128 22.425 11l-5.532 5.556-3.319-3.335-1.123 1.129a1.552 1.552 0 0 0 0 2.188L16.892 21l6.657-6.685a1.55 1.55 0 0 0 0-2.187Z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 539 B

+2 -2
View File
@@ -5,8 +5,8 @@
from odoo import http
class Home(http.Controller):
@http.route('/WW_verify_JV7hMnVdLOHtUbgO.txt', type='http', auth="public")
@http.route('/WW_verify_fC7AX158Ffby8Ed1.txt', type='http', auth="public")
def WW_verify_UP42BAWNwtWK60RH(self):
return 'JV7hMnVdLOHtUbgO'
return 'fC7AX158Ffby8Ed1'