添加功能
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
from . import models
|
from . import models
|
||||||
|
from . import wizard
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/contract_code_data.xml',
|
'data/contract_code_data.xml',
|
||||||
|
'wizard/yuthon_contract_wizard_views.xml',
|
||||||
'views/inherit_hr_contract_views.xml',
|
'views/inherit_hr_contract_views.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -48,4 +48,14 @@ class HrContract(models.Model):
|
|||||||
wage_id = self.env['hr.salary.rule'].search([('struct_id.name', '=', record.structure_type_id.name),
|
wage_id = self.env['hr.salary.rule'].search([('struct_id.name', '=', record.structure_type_id.name),
|
||||||
('yuthon_company','=', record.yuthon_company), ('name', '=','基本工资')])
|
('yuthon_company','=', record.yuthon_company), ('name', '=','基本工资')])
|
||||||
if wage_id:
|
if wage_id:
|
||||||
record.wage = wage_id.amount_fix
|
record.wage = wage_id.amount_fix
|
||||||
|
|
||||||
|
def action_hr_contract(self):
|
||||||
|
return {
|
||||||
|
"type": "ir.actions.act_window",
|
||||||
|
"name": "批量导入合同",
|
||||||
|
"res_model": "yuthon.contract.wizard",
|
||||||
|
"view_mode": "form",
|
||||||
|
"target": "new",
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_yuthon_contract_wizard,yuthon.contract.wizard,model_yuthon_contract_wizard,,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -66,7 +66,7 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="wage_type"/>
|
<field name="wage_type"/>
|
||||||
<field name="schedule_pay"/>
|
<field name="schedule_pay"/>
|
||||||
<field name="wage" string="基本薪资"/>
|
<field name="wage" string="基本薪资" required="False"/>
|
||||||
</group>
|
</group>
|
||||||
<group/>
|
<group/>
|
||||||
</group>
|
</group>
|
||||||
@@ -74,4 +74,11 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="all_data_write_user_contract" model="ir.actions.server">
|
||||||
|
<field name="name">批量导入合同</field>
|
||||||
|
<field name="model_id" ref="hr_contract.model_hr_contract"/>
|
||||||
|
<field name="binding_model_id" ref="hr_contract.model_hr_contract"/>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">action = model.action_hr_contract()</field>
|
||||||
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
from . import yuthon_contract_wizard
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from odoo import models, fields, api, _, SUPERUSER_ID
|
||||||
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
import xlrd
|
||||||
|
import base64
|
||||||
|
import datetime
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class YuthonContractWizard(models.Model):
|
||||||
|
_name = 'yuthon.contract.wizard'
|
||||||
|
|
||||||
|
excel_file = fields.Binary(string="上传Excel表")
|
||||||
|
excel_name = fields.Char(string="文件名")
|
||||||
|
|
||||||
|
def confirm(self):
|
||||||
|
"""
|
||||||
|
导入excel文件,按行读取数据并处理
|
||||||
|
:return: 导入员工信息表并更新
|
||||||
|
"""
|
||||||
|
if not self.excel_file:
|
||||||
|
raise ValidationError('请上传文件。')
|
||||||
|
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
|
||||||
|
sh = book.sheet_by_index(0)
|
||||||
|
for rx in range(1, sh.nrows):
|
||||||
|
row = sh.row(rx)
|
||||||
|
self.employee_contract_data(row)
|
||||||
|
|
||||||
|
def employee_contract_data(self,row):
|
||||||
|
employee_id = self.env['hr.employee'].search([('name', '=', row[1].value)])
|
||||||
|
structure_type_id = self.env['hr.payroll.structure.type'].search([('name', '=', row[4].value), ('yuthon_company', '=', 'thwg')])
|
||||||
|
party_id = self.env['yuthon.party.setting'].search([('party', '=', row[5].value)])
|
||||||
|
contract_type_id = self.env['hr.contract.type'].search([('name', '=', row[6].value)])
|
||||||
|
wage_id = self.env['hr.salary.rule'].search([('struct_id.name', '=', structure_type_id.name),
|
||||||
|
('yuthon_company', '=', 'thwg'),
|
||||||
|
('name', '=', '基本工资')])
|
||||||
|
wage = wage_id.amount_fix
|
||||||
|
self.env['hr.contract'].create({
|
||||||
|
'employee_id': employee_id.id,
|
||||||
|
'structure_type_id':structure_type_id.id,
|
||||||
|
'party_id':party_id.id,
|
||||||
|
'contract_type_id':contract_type_id.id,
|
||||||
|
'wage':wage
|
||||||
|
})
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="yuthon_contract_wizard_form" model="ir.ui.view">
|
||||||
|
<field name="name">审批意见弹窗</field>
|
||||||
|
<field name="model">yuthon.contract.wizard</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<sheet>
|
||||||
|
<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"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
@@ -16,6 +16,11 @@
|
|||||||
'views/hr_leave_batch.xml',
|
'views/hr_leave_batch.xml',
|
||||||
'wizard/yuthon_fixes_wizard_views.xml',
|
'wizard/yuthon_fixes_wizard_views.xml',
|
||||||
],
|
],
|
||||||
|
'assets': {
|
||||||
|
'web.assets_backend': [
|
||||||
|
'yuthon_holiday/static/scss/yuthon_leave_scss.scss',
|
||||||
|
],
|
||||||
|
},
|
||||||
'demo': [],
|
'demo': [],
|
||||||
'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee', 'base', 'yuthon_issue', 'documents', 'mail', 'soong_workflow'],
|
'depends': ['hr_holidays', 'planning', 'hr', 'yuthon_hr_employee', 'base', 'yuthon_issue', 'documents', 'mail', 'soong_workflow'],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class HolidaysRequestBatch(models.Model):
|
|||||||
|
|
||||||
name = fields.Char(string='标题')
|
name = fields.Char(string='标题')
|
||||||
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp, index=True)
|
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp, index=True)
|
||||||
|
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'),
|
||||||
|
('thlc', '天河粮储')], string="所属公司", related='employee_id.yuthon_company')
|
||||||
state = fields.Selection(string='状态', selection=[
|
state = fields.Selection(string='状态', selection=[
|
||||||
('draft', '撤回'),
|
('draft', '撤回'),
|
||||||
('confirm', '转交'),
|
('confirm', '转交'),
|
||||||
@@ -112,6 +114,8 @@ class HrLeaveLine(models.Model):
|
|||||||
|
|
||||||
leave_batch_id = fields.Many2one('hr.leave.batch', string="关联请假审批")
|
leave_batch_id = fields.Many2one('hr.leave.batch', string="关联请假审批")
|
||||||
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', related='leave_batch_id.employee_id')
|
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', related='leave_batch_id.employee_id')
|
||||||
|
start_unit = fields.Selection([('day', '上半天'),('hour', '下半天')], string='单位')
|
||||||
|
end_unit = fields.Selection([('day', '上半天'),('hour', '下半天')], string='单位')
|
||||||
leave_type_id = fields.Many2one(
|
leave_type_id = fields.Many2one(
|
||||||
string="请假类型",
|
string="请假类型",
|
||||||
comodel_name='hr.leave.type',
|
comodel_name='hr.leave.type',
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.list_width{
|
||||||
|
width: 200px !important;
|
||||||
|
max-width: 200px !important;
|
||||||
|
}
|
||||||
|
.list_width2{
|
||||||
|
width: 100px !important;
|
||||||
|
max-width: 100px !important;
|
||||||
|
}
|
||||||
|
.list_ids_width{
|
||||||
|
width: 200px !important;
|
||||||
|
max-width: 200px !important;
|
||||||
|
}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="leave_batch_id" column_invisible="1"/>
|
<field name="leave_batch_id" column_invisible="1"/>
|
||||||
<field name="employee_id" column_invisible="1"/>
|
<field name="employee_id" column_invisible="1"/>
|
||||||
<field name="leave_type_id"
|
<field name="leave_type_id" class="list_width2"
|
||||||
force_save="1"
|
force_save="1"
|
||||||
domain="[
|
domain="[
|
||||||
('request_unit', '=', leave_unit),
|
('request_unit', '=', leave_unit),
|
||||||
@@ -74,8 +74,10 @@
|
|||||||
options="{'no_create': True, 'no_open': True, 'request_type': 'leave'}"
|
options="{'no_create': True, 'no_open': True, 'request_type': 'leave'}"
|
||||||
/>
|
/>
|
||||||
<field name="duration_leave"/>
|
<field name="duration_leave"/>
|
||||||
<field name="start_time"/>
|
<field name="start_unit"/>
|
||||||
<field name="end_time"/>
|
<field name="start_time" class="list_width"/>
|
||||||
|
<field name="end_unit"/>
|
||||||
|
<field name="end_time" class="list_width"/>
|
||||||
<field name="leave_unit" column_invisible="1" force_save="1"/>
|
<field name="leave_unit" column_invisible="1" force_save="1"/>
|
||||||
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': '查看详情'}"/>
|
<field name="leave_documents_ids" widget="preview_many2many" options="{'preview_type': 'button', 'preview_string': '查看详情'}"/>
|
||||||
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
|
<field name="custom_document_ids" widget="preview_many2many" options="{'show_select_btn': false}"/>
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ class YuthonDutyPlan(models.Model):
|
|||||||
def auto_duty_plan(self):
|
def auto_duty_plan(self):
|
||||||
role_a = self.env['planning.role'].search([('name', '=', '联安粮库')], limit=1)
|
role_a = self.env['planning.role'].search([('name', '=', '联安粮库')], limit=1)
|
||||||
role_template_a = self.env['planning.slot.template'].search([('planning_name', '=', '白班'), ('role_id', '=', role_a.id)])
|
role_template_a = self.env['planning.slot.template'].search([('planning_name', '=', '白班'), ('role_id', '=', role_a.id)])
|
||||||
role_template_b = self.env['planning.slot.template'].search([('planning_name', '=', '值班'), ('role_id', '=', role_a.id)])
|
|
||||||
today = datetime.today().date()
|
today = datetime.today().date()
|
||||||
first_day_of_month = today.replace(day=1)
|
first_day_of_month = today.replace(day=1)
|
||||||
if today.month < 12:
|
if today.month < 12:
|
||||||
@@ -31,15 +30,6 @@ class YuthonDutyPlan(models.Model):
|
|||||||
while current_date <= last_day_of_month:
|
while current_date <= last_day_of_month:
|
||||||
self.create_planning_slot(employee, role_a, role_template_a, current_date)
|
self.create_planning_slot(employee, role_a, role_template_a, current_date)
|
||||||
current_date += timedelta(days=1)
|
current_date += timedelta(days=1)
|
||||||
|
|
||||||
current_date = first_day_of_month
|
|
||||||
for line in self.plan_line_ids.sorted('sequence'):
|
|
||||||
for employee in line.employee_ids:
|
|
||||||
|
|
||||||
self.create_planning_slot(employee, role_a, role_template_b, current_date)
|
|
||||||
current_date += timedelta(days=1)
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.client',
|
'type': 'ir.actions.client',
|
||||||
'tag': 'display_notification',
|
'tag': 'display_notification',
|
||||||
|
|||||||
@@ -95,11 +95,14 @@ class HrJob(models.Model):
|
|||||||
if department_id:
|
if department_id:
|
||||||
job.sudo().write({'department_id': department_id.id if len(department_id) == 1 else department_id[0].id})
|
job.sudo().write({'department_id': department_id.id if len(department_id) == 1 else department_id[0].id})
|
||||||
|
|
||||||
# @api.onchange('job_personnel_ids')
|
|
||||||
# def _onchange_job_personnel_ids(self):
|
|
||||||
# for employee in self.job_personnel_ids:
|
|
||||||
# employee.job_id = self.id
|
|
||||||
|
|
||||||
|
@api.onchange('department_id')
|
||||||
|
def onchange_department_id(self):
|
||||||
|
company_mapping = {
|
||||||
|
'天河投资集团':'thtz' , '天河物管': 'thwg', '天河粮储':'thlc', '集团本部': 'thtjbb'
|
||||||
|
}
|
||||||
|
yuthon_company = company_mapping.get(self.department_id.parent_id.name)
|
||||||
|
self.yuthon_company = yuthon_company
|
||||||
|
|
||||||
class HrJobType(models.Model):
|
class HrJobType(models.Model):
|
||||||
_name = "hr.job.type"
|
_name = "hr.job.type"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<field name="user_state"/>
|
<field name="user_state"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='user_role_ids']" position="after">
|
<xpath expr="//field[@name='user_role_ids']" position="after">
|
||||||
<field name="contract_company"/>
|
<field name="yuthon_company" readonly="0"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[@name='public']" position="after">
|
<xpath expr="//page[@name='public']" position="after">
|
||||||
<page name="技能证书管理">
|
<page name="技能证书管理">
|
||||||
|
|||||||
Reference in New Issue
Block a user