diff --git a/soong_workflow/__manifest__.py b/soong_workflow/__manifest__.py
index 646266375..05ce54166 100644
--- a/soong_workflow/__manifest__.py
+++ b/soong_workflow/__manifest__.py
@@ -22,6 +22,7 @@
"views/soong_workflow_record.xml",
"views/soong_approval_group.xml",
'wizard/approval_notice_wizard_views.xml',
+ 'wizard/soong_transmitted_wizard_views.xml',
"wizard/soong_workflow_comment_wizard_view.xml",
"templates/soong_workflow_templates.xml",
],
diff --git a/soong_workflow/models/soong_workflow.py b/soong_workflow/models/soong_workflow.py
index 3e9a6c682..9e8652b10 100644
--- a/soong_workflow/models/soong_workflow.py
+++ b/soong_workflow/models/soong_workflow.py
@@ -45,27 +45,16 @@ class SoongWorkflow(models.Model):
domain=MODEL_DOMAIN,
help="Enter business model you would like to modify its workflow.",
)
- node_ids = fields.One2many(
- comodel_name="soong.workflow.node", inverse_name="workflow_id", string="Nodes"
- )
- link_ids = fields.One2many(
- comodel_name="soong.workflow.link", inverse_name="workflow_id", string="Links"
- )
- remove_default_btn_until_end = fields.Boolean(
- string="是否覆盖表头按钮状态", default=False
- )
- is_enable_return_button = fields.Boolean(
- string="是否启用收回", default=True
- )
-
- current_stage_highlight_color = fields.Char(
- default="rgb(0, 255, 255)",
- help="The color to highlight the current stage on flow",
- )
+ node_ids = fields.One2many(comodel_name="soong.workflow.node", inverse_name="workflow_id", string="Nodes")
+ link_ids = fields.One2many(comodel_name="soong.workflow.link", inverse_name="workflow_id", string="Links")
+ remove_default_btn_until_end = fields.Boolean(string="是否覆盖表头按钮状态", default=False)
+ current_stage_highlight_color = fields.Char(default="rgb(0, 255, 255)",help="The color to highlight the current stage on flow",)
start_time = fields.Datetime(string="生效日期", copy=False, default=fields.Datetime.now)
end_time = fields.Datetime(string="失效日期", copy=False)
is_enable = fields.Boolean(string="是否启用", default="False", compute="compute_is_enable", store=True)
+ is_enable_return_button = fields.Boolean(string="是否启用收回", default=True)
+ is_enable_transmitted_button = fields.Boolean(string="是否启用转交", default=True)
approvals_group_id = fields.Many2one('soong.approval.group', string="审批分组")
def copy(self, default=None):
diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index 2a8c90990..eb1d71d0b 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -242,14 +242,17 @@ class SoongWorkflowMixin(models.AbstractModel):
res = self._update_fields_view(view_type, res)
# res = self._add_state_tree_view(view_type, res)
res = self._add_soong_workflow_log(view_type, res, params)
- # 收回
+ # todo 后许可拓展退回层级
res = self._add_return_button(view_type, res)
+ # 转交 如果一条链路直接跳转,如果多条链路选择跳转
+ # res = self._add_transmitted_button(view_type, res)
return res
+ # 收回逻辑
def _add_return_button(self, view_type, res):
model = self._name
wkf_obj = self.env["soong.workflow"]
- wkf_rec = wkf_obj.search([("model_id", "=", model)])
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
if not wkf_rec.is_enable_return_button:
return res
@@ -260,9 +263,9 @@ class SoongWorkflowMixin(models.AbstractModel):
header_el = header_el[0] if header_el else False
if header_el:
button = etree.Element("button", {
- "name": "action_return", # 这里定义了按钮执行的服务器端动作
- "type": "object", # 触发自定义对象动作
- "string": "收回", # 按钮显示的名称
+ "name": "action_return",
+ "type": "object",
+ "string": "收回",
"class": "btn-primary", # 按钮的样式
# "icon": "fa-undo", # 按钮图标 (如果需要)
})
@@ -328,6 +331,35 @@ class SoongWorkflowMixin(models.AbstractModel):
# btn_invisible = btn_invisible + " or " + button.attrib["invisible"]
# button.set("invisible", btn_invisible)
+ # 转交
+ def _add_transmitted_button(self, view_type, res):
+ model = self._name
+ wkf_obj = self.env["soong.workflow"]
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
+
+ if not wkf_rec.is_enable_transmitted_button:
+ return res
+
+ arch = etree.fromstring(res["arch"])
+ if view_type == "form":
+ header_el = arch.xpath("//form/header")
+ header_el = header_el[0] if header_el else False
+ if header_el:
+ button = etree.Element("button", {
+ "name": "action_transmitted",
+ "type": "object",
+ "string": "转交",
+ "class": "btn-primary", # 按钮的样式
+ })
+ header_el.append(button)
+ res["arch"] = etree.tostring(arch, encoding="unicode").replace("\t", "")
+ return res
+
+ def action_transmitted(self):
+ # 判断链路是一个就跳转
+ # 是多个就弹窗选择
+ pass
+
def _remove_default_header(self, view_type, res):
"""
Removes default header element from form view.
@@ -337,7 +369,7 @@ class SoongWorkflowMixin(models.AbstractModel):
"""
model = self._name
wkf_obj = self.env["soong.workflow"]
- wkf_rec = wkf_obj.search([("model_id", "=", model)])
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
if not wkf_rec.remove_default_btn_until_end:
return res
@@ -441,7 +473,7 @@ class SoongWorkflowMixin(models.AbstractModel):
header_el = etree.Element("header")
form_el.insert(0, header_el)
# Construct Buttons & Fields Tags
- wkf_rec = wkf_obj.search([("model_id", "=", model)])
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
for node in wkf_rec.node_ids:
for button in node.button_ids:
# Check Condition Code
@@ -528,7 +560,7 @@ class SoongWorkflowMixin(models.AbstractModel):
model = self._name
visible_seq = []
arch = etree.fromstring(res["arch"])
- wkf_rec = wkf_obj.search([("model_id", "=", model)])
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
# Find header & ADD state
if view_type == "form":
@@ -618,7 +650,7 @@ class SoongWorkflowMixin(models.AbstractModel):
# Variables
model = self._name
uid = self._uid
- wkf_rec = wkf_obj.search([("model_id", "=", model)])
+ wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
arch = etree.fromstring(res["arch"])
# Helper Functions
diff --git a/soong_workflow/models/soong_workflow_node.py b/soong_workflow/models/soong_workflow_node.py
index 706168c81..40df51c27 100644
--- a/soong_workflow/models/soong_workflow_node.py
+++ b/soong_workflow/models/soong_workflow_node.py
@@ -129,9 +129,7 @@ class SoongWorkflowNode(models.Model):
compute="_compute_custom_colors", readonly=True, string="Label Color"
)
- @api.depends(
- "bg_color", "label_color", "use_custom_colors", "flow_start", "flow_end"
- )
+ @api.depends("bg_color", "label_color", "use_custom_colors", "flow_start", "flow_end")
def _compute_custom_colors(self):
for rec in self:
if rec.use_custom_colors:
@@ -290,7 +288,7 @@ class SoongWorkflowNodeButton(models.Model):
rec.workflow_id = (
self.env["soong.workflow"]
.sudo()
- .search([("model_id", "=", model_id)])
+ .search([("model_id", "=", model_id), ('is_enable', '=', 'yes')])
)
@api.constrains("btn_key")
diff --git a/soong_workflow/security/ir.model.access.csv b/soong_workflow/security/ir.model.access.csv
index ceb16fda0..bd24009db 100644
--- a/soong_workflow/security/ir.model.access.csv
+++ b/soong_workflow/security/ir.model.access.csv
@@ -23,4 +23,6 @@ access_soong_approval_group,soong_approval_group,model_soong_approval_group,soon
access_soong_approval_notice_wizard,soong_approval_notice_wizard,model_soong_approval_notice_wizard,base.group_user,1,1,1,1
access_soong_workflow_log_user,soong_workflow_log_user,model_soong_workflow_log,soong_workflow.group_soong_workflow_user,1,1,1,1
-access_soong_workflow_comment_wizard_user,soong_workflow_comment_wizard_user,model_soong_workflow_comment_wizard,soong_workflow.group_soong_workflow_user,1,1,1,1
\ No newline at end of file
+access_soong_workflow_comment_wizard_user,soong_workflow_comment_wizard_user,model_soong_workflow_comment_wizard,soong_workflow.group_soong_workflow_user,1,1,1,1
+
+access_soong_approval_transmitted_wizard,soong_approval_transmitted_wizard,model_soong_approval_transmitted_wizard,soong_workflow.group_soong_workflow_user,1,1,1,1
\ No newline at end of file
diff --git a/soong_workflow/views/soong_note_views.xml b/soong_workflow/views/soong_note_views.xml
index f2c1de165..9e3d00a56 100644
--- a/soong_workflow/views/soong_note_views.xml
+++ b/soong_workflow/views/soong_note_views.xml
@@ -39,7 +39,7 @@
action="soong_note_action"/>
diff --git a/soong_workflow/views/soong_workflow_views.xml b/soong_workflow/views/soong_workflow_views.xml
index ca069047d..502a5ee36 100644
--- a/soong_workflow/views/soong_workflow_views.xml
+++ b/soong_workflow/views/soong_workflow_views.xml
@@ -90,10 +90,10 @@
tree,form
-
+
+
+
+
+
diff --git a/soong_workflow/wizard/__init__.py b/soong_workflow/wizard/__init__.py
index 442fe0891..b8d44c6f0 100644
--- a/soong_workflow/wizard/__init__.py
+++ b/soong_workflow/wizard/__init__.py
@@ -3,6 +3,9 @@
from . import approval_notice_wizard
+from . import soong_transmitted_wizard
from . import soong_workflow_comment_wizard
+
+
diff --git a/soong_workflow/wizard/soong_transmitted_wizard.py b/soong_workflow/wizard/soong_transmitted_wizard.py
new file mode 100644
index 000000000..3fa508c64
--- /dev/null
+++ b/soong_workflow/wizard/soong_transmitted_wizard.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from odoo import api, fields, models, tools, _
+from datetime import datetime, date, time, timedelta
+from odoo.tools.safe_eval import safe_eval
+from odoo.exceptions import ValidationError, UserError
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class SoongApprovalTransmittedWizard(models.TransientModel):
+ _name = 'soong.approval.transmitted.wizard'
+ _description = """ 转交弹窗 """
+
+ name = fields.Char(string='名称')
+
+ def confirm(self):
+ pass
\ No newline at end of file
diff --git a/soong_workflow/wizard/soong_transmitted_wizard_views.xml b/soong_workflow/wizard/soong_transmitted_wizard_views.xml
new file mode 100644
index 000000000..162ea4ab4
--- /dev/null
+++ b/soong_workflow/wizard/soong_transmitted_wizard_views.xml
@@ -0,0 +1,19 @@
+
+
+
+ 一键转交
+ soong.approval.transmitted.wizard
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_hr_attendance/views/all_attendance_menu.xml b/yuthon_hr_attendance/views/all_attendance_menu.xml
index 449dcfc7c..58d2bfaf8 100644
--- a/yuthon_hr_attendance/views/all_attendance_menu.xml
+++ b/yuthon_hr_attendance/views/all_attendance_menu.xml
@@ -24,5 +24,6 @@
sequence="15" action="attendance_iot_manager_action"/>
-
+
\ No newline at end of file
diff --git a/yuthon_hr_attendance/views/attendance_iot_manager_views.xml b/yuthon_hr_attendance/views/attendance_iot_manager_views.xml
index 7d02ea86e..6b6b07b99 100644
--- a/yuthon_hr_attendance/views/attendance_iot_manager_views.xml
+++ b/yuthon_hr_attendance/views/attendance_iot_manager_views.xml
@@ -25,7 +25,7 @@
- 假期类型配置
+ 考勤机设备管理
attendance.iot.manager
tree
diff --git a/yuthon_hr_employee/__manifest__.py b/yuthon_hr_employee/__manifest__.py
index 45d2e9028..e5536f65c 100644
--- a/yuthon_hr_employee/__manifest__.py
+++ b/yuthon_hr_employee/__manifest__.py
@@ -13,9 +13,8 @@
'website': 'https://www.pengyuthon.com',
'depends': ['base', 'hr'],
'data': [
- # 'data/hr_department_data.xml',
- # 'data/user_role_data.xml',
'data/yuthon.job.lv.csv',
+ 'data/employee_code_data.xml',
'security/ir.model.access.csv',
'views/yuthon_hr_employee_views.xml',
'views/yuthon_hr_department_views.xml',
diff --git a/yuthon_hr_employee/data/employee_code_data.xml b/yuthon_hr_employee/data/employee_code_data.xml
new file mode 100644
index 000000000..d65994304
--- /dev/null
+++ b/yuthon_hr_employee/data/employee_code_data.xml
@@ -0,0 +1,9 @@
+
+
+
+ 员工编号
+ employee_code
+ US%(y)s%(month)s%(day)s
+ 3
+
+
diff --git a/yuthon_hr_employee/data/hr_department_data.xml b/yuthon_hr_employee/data/hr_department_data.xml
deleted file mode 100644
index 1935d5e05..000000000
--- a/yuthon_hr_employee/data/hr_department_data.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
- 天河投资
- False
- False
-
-
-
- 新兴协会
- 广州市天河区龙口西路90号天成大厦3楼东侧
- True
- False
-
-
-
- 科创中心
- 广州市天河区龙口西路90号天成大厦4楼东侧
- True
- False
-
-
-
- 管理员
- 广州市天河区龙口西路90号天成大厦5楼东侧
- False
- False
-
-
-
- 外派
- 广州市天河区龙口西路90号天成大厦6楼东侧
- False
- False
-
-
-
- 粮储公司
- 广州市天河区龙口西路90号天成大厦7楼东侧
- False
- False
-
-
-
- 商业总公司
- 广州市天河区龙口西路90号天成大厦8楼东侧
- False
- False
-
-
-
- 领导班子
- 广州市天河区龙口西路90号天成大厦9楼东侧
- False
- False
-
-
-
-
- 财务部
- 广州市天河区龙口西路90号天成大厦10楼东侧
- False
- False
-
-
-
-
- 办公室
- 广州市天河区龙口西路90号天成大厦11楼东侧
- False
- False
-
-
-
-
- 企业管理部
- 广州市天河区龙口西路90号天成大厦12楼东侧
- False
- False
-
-
-
-
- 租务二部(原物业经营部)
- 广州市天河区龙口西路90号天成大厦13楼东侧
- False
- False
-
-
-
-
- 资本运营部
- 广州市天河区龙口西路90号天成大厦14楼东侧
- False
- False
-
-
-
-
- 投资发展部
- 广州市天河区龙口西路90号天成大厦15楼东侧
- False
- False
-
-
-
-
- 党群人力资源部
- 广州市天河区龙口西路90号天成大厦16楼东侧
- False
- False
-
-
-
-
- 风控审计部
- 广州市天河区龙口西路90号天成大厦17楼东侧
- False
- False
-
-
-
-
- 人事部
- 广州市天河区龙口西路90号天成大厦18楼东侧
- False
- False
-
-
-
-
- 厨位人员
- 广州市天河区龙口西路90号天成大厦19楼东侧
- False
- False
-
-
-
\ No newline at end of file
diff --git a/yuthon_hr_employee/data/user_role_data.xml b/yuthon_hr_employee/data/user_role_data.xml
deleted file mode 100644
index 19fc7dd2f..000000000
--- a/yuthon_hr_employee/data/user_role_data.xml
+++ /dev/null
@@ -1,396 +0,0 @@
-
-
-
- 普通员工
- system_global_user
-
-
-
- 常务副秘书长
- departmental_role
- association
-
-
-
- 总经理
- system_global_user
-
-
-
- 理事长
- system_global_user
-
-
-
- 常务副会长
- system_global_user
-
-
-
- 副总经理
- system_global_user
-
-
-
- 监事会主席
- system_global_user
-
-
-
- 秘书处办公室主任
- system_global_user
-
-
-
- 分管领导
- system_global_user
-
-
-
- 部门副经理
- system_global_user
-
-
-
- 秘书处办公室副主任
- system_global_user
-
-
-
- 部门经理
- system_global_user
-
-
-
- 各企业班子(发文)
- system_global_user
-
-
-
- 试用期员工
- system_global_user
-
-
-
- 物业部副总经理
- departmental_role
- rent2
-
-
-
- 理事会成员
- system_global_user
-
-
-
- 安全办成员
- system_global_user
-
-
-
- 实习
- system_global_user
-
-
-
- 副院长
- system_global_user
-
-
-
- 院长
- system_global_user
-
-
-
- 党员
- system_global_user
-
-
-
- 科创中心
- system_global_user
-
-
-
- 需考勤人员
- system_global_user
-
-
-
- 财务(物业)
- system_global_user
-
-
-
- 集团安委会
- system_global_user
-
-
-
- 天投城建安全办
- system_global_user
-
-
-
- 集团安全办
- system_global_user
-
-
-
- 天投城建安委会
- system_global_user
-
-
-
- 天投城建安委会
- system_global_user
-
-
-
- 公司领导
- system_global_user
-
-
-
- 领导班子
- system_global_user
-
-
-
- 董事长
- system_global_user
-
-
-
- 执行董事
- departmental_role
- storage_company
-
-
-
- 秘书长
- departmental_role
- association
-
-
-
- 副主任
- system_global_user
-
-
-
- 工会委员
- system_global_user
-
-
-
- 风控审计经理
- departmental_role
- risk_department
-
-
-
- 风控管理岗
- departmental_role
- risk_department
-
-
-
- 系统管理员
- oa_admin
-
-
-
- 安全办副主任
- system_global_user
-
-
-
- 投融资部经理
- departmental_role
- capital_department
-
-
-
- 投融资部副总经理
- departmental_role
- capital_department
-
-
-
- 投融资部副经理
- departmental_role
- capital_department
-
-
-
- 投融资发展部
- departmental_role
- capital_department
-
-
-
- 项目开发部
- departmental_role
- investment_department
-
-
-
- 项目部经理
- departmental_role
- investment_department
-
-
-
- 人事专员
- departmental_role
- party_department
-
-
-
- 党建专员
- departmental_role
- party_department
-
-
-
- 人事管理员
- departmental_role
- party_department
-
-
-
- 人事主管
- departmental_role
- party_department
-
-
-
- 物业部
- departmental_role
- rent2
-
-
-
- 物业部经理
- departmental_role
- rent2
-
-
-
- 物业部副经理
- departmental_role
- rent2
-
-
-
- 工程主管
- departmental_role
- rent2
-
-
-
- 企业管理部
- departmental_role
- enterprise_department
-
-
-
- 企业管理部经理
- departmental_role
- enterprise_department
-
-
-
- 财务部
- departmental_role
- accounting_department
-
-
-
- 财务部经理
- departmental_role
- accounting_department
-
-
-
- 财务部副经理
- departmental_role
- accounting_department
-
-
-
- 会计
- departmental_role
- accounting_department
-
-
-
- 出纳
- departmental_role
- accounting_department
-
-
-
- 办公室
- departmental_role
- office
-
-
-
- 主任
- departmental_role
- office
-
-
-
- 办公室副主任
- departmental_role
- office
-
-
-
- 公文管理员
- departmental_role
- office
-
-
-
- 厨卫人员
- departmental_role
- office
-
-
-
- 办公库管
- departmental_role
- office
-
-
-
- 子企业人员
- departmental_role
- office
-
-
-
- 信息发布员
- departmental_role
- office
-
-
-
- 交通安全员
- system_global_user
-
-
-
-
- 外派
- departmental_role
- expatriate
-
-
-
-
\ No newline at end of file
diff --git a/yuthon_hr_employee/models/yuthon_hr_department.py b/yuthon_hr_employee/models/yuthon_hr_department.py
index cb6b1e21a..a9606bd1e 100644
--- a/yuthon_hr_employee/models/yuthon_hr_department.py
+++ b/yuthon_hr_employee/models/yuthon_hr_department.py
@@ -4,6 +4,7 @@ from odoo import api, fields, models
class YuthonHrDepartment(models.Model):
_inherit = "hr.department"
+ _order = 'department_code'
department_phone = fields.Char(string="部门电话")
department_fax = fields.Char(string="部门传真")
@@ -13,3 +14,4 @@ class YuthonHrDepartment(models.Model):
is_global_department = fields.Boolean(string="是否全局部门")
create_time = fields.Datetime(string="创建时间", default=fields.Datetime.now)
end_time = fields.Datetime(string="结束时间")
+ department_code = fields.Char(string="部门序号")
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index 5cb0e39e4..79316a0ea 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -20,13 +20,15 @@ class YuthonHrEmployee(models.Model):
对原模型数据的隐藏,字段的开发和添加
"""
_inherit = "hr.employee"
+ _order = 'number'
# odoo里是这样做的,一个用户可以多个公司绑定多个员工,每个员工都有自己的部门和岗位
- number = fields.Char(string="编号")
+ number = fields.Char(string="序号", store=True)
+ user_number = fields.Char(string="员工编号", default=lambda self: self.env['ir.sequence'].next_by_code('employee_code'))
use_user_type = fields.Selection([('formal', '正式职工'), ('labor', '劳务协议'),
('part_time', '兼职协议'), ('employment', '兼职用工')], string="用工形式")
- user_number = fields.Char(string="员工编号")
+
job_lv_id = fields.Many2one('yuthon.job.lv', string="最新职级")
# 个人信息
user_salary = fields.Float(string="基本工资")
@@ -35,7 +37,8 @@ class YuthonHrEmployee(models.Model):
confirmation_date = fields.Date(string="转正时间")
company_old = fields.Char(string="司龄", compute='_compute_company_old')
user_sex = fields.Selection([('girl', '女'), ('boy', '男')], string="性别")
- user_state = fields.Selection([('in', '在职'), ('leave', '离职'), ('withdraw', '退休')], string="员工状态",compute='_compute_user_state')
+ user_state = fields.Selection([('in', '在职'), ('leave', '离职'), ('withdraw', '退休')],
+ string="员工状态", compute='_compute_user_state')
user_number_start_time = fields.Date(string="身份中有效开始时间")
user_number_end_time = fields.Date(string="身份证有效到期时间")
nation = fields.Selection(nation_list, string="民族")
@@ -44,7 +47,8 @@ class YuthonHrEmployee(models.Model):
user_type = fields.Char(string="人员类别")
retire_date = fields.Date(string="退休日期")
retire_years = fields.Integer(string="离退休年限", compute='_compute_retire_years')
- political_aspects = fields.Selection([('cpc_dang', '中共党员'), ('nld', '民盟'), ('league_member', '共青团员'), ('people', '群众')], string="政治面貌")
+ political_aspects = fields.Selection([('cpc_dang', '中共党员'), ('nld', '民盟'),
+ ('league_member', '共青团员'), ('people', '群众')], string="政治面貌")
dang_data = fields.Date(string="入团(党)时间")
user_origin = fields.Char(string="籍贯")
user_location = fields.Char(string="户口所在地")
@@ -102,6 +106,11 @@ class YuthonHrEmployee(models.Model):
# 技能证书管理
skills_certificates_ids = fields.One2many('yuthon.skills.certificates.line', 'employee_id', string="教育经历明细行")
+ @api.onchange('number')
+ def onchange_number(self):
+ if self.department_id.department_code:
+ self.number = self.department_id.department_code + self.number
+
def action_hr_employee(self):
return {
"type": "ir.actions.act_window",
@@ -165,11 +174,16 @@ class YuthonHrEmployee(models.Model):
def _compute_user_state(self):
for record in self:
today = datetime.now().date()
- if record.new_start_contract_data >= record.new_end_contract_data:
- raise ValidationError('合同开始日期不能大于合同结束日期')
- if record.new_start_contract_data <= today <= record.new_end_contract_data:
- record.user_state = 'in'
+ start_time = record.new_start_contract_data
+ end_time = record.new_end_contract_data
+ if start_time and end_time:
+ if start_time >= end_time:
+ raise ValidationError('合同开始日期不能大于合同结束日期')
+ if start_time <= today <= end_time:
+ record.user_state = 'in'
+ else:
+ record.user_state = 'leave'
else:
- record.user_state = 'leave'
+ record.user_state = ''
diff --git a/yuthon_hr_employee/views/yuthon_hr_department_views.xml b/yuthon_hr_employee/views/yuthon_hr_department_views.xml
index 7bd5f6286..8f2c8fd4e 100644
--- a/yuthon_hr_employee/views/yuthon_hr_department_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_department_views.xml
@@ -7,6 +7,7 @@
+
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index 9b22dbde4..5f8c07127 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -200,9 +200,6 @@
1
-
- 上级领导
-
@@ -232,6 +229,9 @@
+
+
+
@@ -242,44 +242,4 @@
code
action = model.action_hr_employee()
-
-
-
- 在职
- hr.employee
- kanban,tree,form
- [('user_state','=','in')]
-
-
-
- 离职
- hr.employee
- kanban,tree,form
- [('user_state','=','leave')]
-
-
-
- 退休
- hr.employee
- kanban,tree,form
- [('user_state','=','withdraw')]
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/yuthon_party/views/menuitem.xml b/yuthon_party/views/menuitem.xml
index 832b1b221..44f638cdb 100644
--- a/yuthon_party/views/menuitem.xml
+++ b/yuthon_party/views/menuitem.xml
@@ -1,50 +1,133 @@
- 党群
- yuthon.party
- tree,form
+ 党建
+ yuthon.party
+ tree,form
-
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_performance/views/yuthon_performance_menus.xml b/yuthon_performance/views/yuthon_performance_menus.xml
index 3ae519d36..09566a447 100644
--- a/yuthon_performance/views/yuthon_performance_menus.xml
+++ b/yuthon_performance/views/yuthon_performance_menus.xml
@@ -47,17 +47,17 @@
action="yuthon_index_management_action"/>
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py
index baf0e862b..4af517a72 100644
--- a/yuthon_property/__manifest__.py
+++ b/yuthon_property/__manifest__.py
@@ -16,6 +16,7 @@
'views/property_move_views.xml',
'views/property_open_rent_views.xml',
'views/property_record_views.xml',
+ 'views/property_type_views.xml',
'views/menuitem.xml',
],
'demo': [],
diff --git a/yuthon_property/models/__init__.py b/yuthon_property/models/__init__.py
index 5b3d1f3e6..82ac8c5b5 100644
--- a/yuthon_property/models/__init__.py
+++ b/yuthon_property/models/__init__.py
@@ -3,4 +3,5 @@ from . import property_assess
from . import property_confirm
from . import property_move
from . import property_open_rent
-from . import property_record
\ No newline at end of file
+from . import property_record
+from . import property_type
diff --git a/yuthon_property/models/property_type.py b/yuthon_property/models/property_type.py
new file mode 100644
index 000000000..14806844e
--- /dev/null
+++ b/yuthon_property/models/property_type.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models, fields, api, exceptions, _
+from datetime import datetime
+from odoo.exceptions import UserError, ValidationError
+
+
+class PropertyType(models.Model):
+ _name = 'property.type'
+ _description = '物业状态'
+ _rec_name = 'name'
+
+ name = fields.Char(string='名称')
+ create_time = fields.Datetime(string="创建日期", default=lambda self: fields.Datetime.now())
+ start_time = fields.Datetime(string="生效日期")
+ end_time = fields.Datetime(string="终止日期")
+ is_enable = fields.Boolean(string="是否启用", compute='_compute_is_enable')
+
+ @api.depends('start_time', 'end_time')
+ def _compute_is_enable(self):
+ for rec in self:
+ if rec.start_time >= rec.end_time:
+ raise ValidationError('合同开始日期不能大于合同结束日期')
+ if rec.start_time and rec.end_time:
+ if rec.start_time < datetime.now() < rec.end_time:
+ rec.is_enable = True
+ else:
+ rec.is_enable = False
+ else:
+ rec.is_enable = False
+
+
+
+
+
+
+
+
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 549e7daa1..0312fde28 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -16,13 +16,15 @@ class YuthonProperty(models.Model):
property_use_id = fields.Integer(string="物业用途ID")
property_asset_type = fields.Selection([('plant', '厂房'), ('goods', '商品'),
('office', '写字楼'), ('dormitory', '宿舍'),
- ('rig','设备等管理用房')], string='资产类型')
+ ('rig', '设备等管理用房')], string='资产类型')
property_asset_use = fields.Selection([('hire', '出租'), ('personal', '自用')], string='资产用途')
property_use_type = fields.Selection([('work', '办公'), ('dorm', '宿舍'), ('cater', '餐饮')], string='使用类型')
property_use_time = fields.Datetime(string="使用年限")
- state = fields.Selection([('could', '可租'), ('done', '已租'), ('none', '空置')], string='状态')
+ property_rent_type = fields.Selection([('could', '可租'), ('no', '不可租'),
+ ('done', '已租'), ('none', '空置')], string="出租状态")
+ state_id = fields.Many2one('property.type', string='状态')
property_source = fields.Selection([('cut', '划入'), ('self', '自建'),
('replace', '置换'), ('buy', '购入'),
- ('entrust','委托'),('Rent','租入')], string='来源')
+ ('entrust', '委托'), ('Rent', '租入')], string='来源')
image_1920 = fields.Image(string="图片")
- description = fields.Html(string="描述")
\ No newline at end of file
+ description = fields.Html(string="描述")
diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv
index eb8bc63c2..36f5d9a1e 100644
--- a/yuthon_property/security/ir.model.access.csv
+++ b/yuthon_property/security/ir.model.access.csv
@@ -5,4 +5,5 @@ access_property_confirm,property_confirm,model_property_confirm,base.group_user,
access_property_move,property_move,model_property_move,base.group_user,1,1,1,1
access_property_open_rent,property_open_rent,model_property_open_rent,base.group_user,1,1,1,1
access_property_record,property_record,model_property_record,base.group_user,1,1,1,1
+access_property_type,property_type,model_property_type,base.group_user,1,1,1,1
diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml
index 34f2cc8fd..381b02387 100644
--- a/yuthon_property/views/menuitem.xml
+++ b/yuthon_property/views/menuitem.xml
@@ -1,6 +1,6 @@
-
+
物业管理
yuthon.property
tree,form
@@ -20,49 +20,26 @@
-
-
-
-
-
-
-
-
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+ action="property_assess_action"/>
+
+
+
+
diff --git a/yuthon_property/views/property_type_views.xml b/yuthon_property/views/property_type_views.xml
new file mode 100644
index 000000000..72b126aa1
--- /dev/null
+++ b/yuthon_property/views/property_type_views.xml
@@ -0,0 +1,22 @@
+
+
+
+ property.type.tree
+ property.type
+
+
+
+
+
+
+
+
+
+
+
+
+ 物业调拨审批
+ property.type
+ tree
+
+
diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml
index 0fe27a24d..4adfec663 100644
--- a/yuthon_property/views/yuthon_property_views.xml
+++ b/yuthon_property/views/yuthon_property_views.xml
@@ -16,7 +16,8 @@
-
+
+
@@ -46,7 +47,8 @@
-
+
+
@@ -69,12 +71,15 @@
yuthon.property.search
yuthon.property
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -84,7 +89,7 @@
yuthon.property.kanban
yuthon.property
-
+
@@ -131,25 +136,4 @@
-
- 可租
- yuthon.property
- tree,form
- [('state','=','could')]
-
-
-
- 已租
- yuthon.property
- tree,form
- [('state','=','done')]
-
-
-
- 空置
- yuthon.property
- tree,form
- [('state','=','none')]
-
-
\ No newline at end of file
diff --git a/yuthon_sale_renting/models/yuthon_product_template.py b/yuthon_sale_renting/models/yuthon_product_template.py
deleted file mode 100644
index 0b0be2cb4..000000000
--- a/yuthon_sale_renting/models/yuthon_product_template.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
-from odoo import models, fields, api, exceptions, _
-
-
-class ProductTemplate(models.Model):
- _inherit = 'product.template'
- _description = '物业基本信息字段添加'
-
- property_number = fields.Char(string="物业编号")
- property_name = fields.Char(string="物业简称")
- property_precinct = fields.Char(string="楼盘片区")
- property_floor = fields.Char(string="楼层")
- # 区,街道
- property_statu = fields.Char(string="物业状态")
- property_main_user = fields.Char(string="权属人")
- property_all_m = fields.Float(string="产权面积")
- # 单位
- property_rent_m = fields.Float(string="可租面积")
- # 单位
- property_certificate = fields.Char(string="产权证号")
- property_start_date = fields.Datetime(string="生效日期")
- property_end_date = fields.Datetime(string="失效日期")
-
-
-
diff --git a/yuthon_sale_renting/views/contacts_inherit_menu_views.xml b/yuthon_sale_renting/views/contacts_inherit_menu_views.xml
index 7baa720a6..9575665c5 100644
--- a/yuthon_sale_renting/views/contacts_inherit_menu_views.xml
+++ b/yuthon_sale_renting/views/contacts_inherit_menu_views.xml
@@ -16,16 +16,16 @@
[('partner_type', '=', 'employee')]
{'default_is_company': True}
-
- 承租方
- res.partner
- kanban,tree,form,activity
-
- [('partner_type', '=', 'tenant')]
- {'default_is_company': True}
-
-
+
+
+
+
+
+
+
+
+
+