diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py
index 1d3568fec..dd0e6238a 100644
--- a/soong_workflow/models/soong_workflow_mixin.py
+++ b/soong_workflow/models/soong_workflow_mixin.py
@@ -63,6 +63,7 @@ class SoongWorkflowMixin(models.AbstractModel):
string="Status",
default=_compute_default_state,
track_visibility="onchange",
+ store = True
)
# approve_state = fields.Selection(
# [
@@ -853,6 +854,11 @@ class SoongWorkflowMixin(models.AbstractModel):
field_inst.set("readonly", "0")
else:
# Set Attributes
+ # if self.state in readonly_arr :
+ # field_inst.set("readonly", "1")
+ # else:
+ # field_inst.set("readonly", "0")
+ read_num = ''
if readonly_arr:
id_el = etree.Element("field")
id_el.set("name", "log_ids")
diff --git a/soong_workflow/models/soong_workflow_node.py b/soong_workflow/models/soong_workflow_node.py
index 2c5fc44e9..79b1bc759 100644
--- a/soong_workflow/models/soong_workflow_node.py
+++ b/soong_workflow/models/soong_workflow_node.py
@@ -271,7 +271,7 @@ class SoongWorkflowNode(models.Model):
field_names = set()
for field_node in xml_tree.xpath("//field"):
field_name = field_node.get("name")
- if field_name:
+ if field_name and field_name != "name_title":
field_names.add(field_name)
for field in self.env["ir.model.fields"].search(
[("model_id", "=", rec.model_id.id), ("name", "in", list(field_names))]):
diff --git a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
index 04587ffe1..e3e668a10 100644
--- a/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
+++ b/yuthon_hr_attendance/models/hr_attendance_detail_wechat.py
@@ -295,9 +295,9 @@ class HrAttendanceDetail(models.Model):
for current_date in self.sudo().divide_time_range_fixed(start_time, now_time):
self.sudo()._do_save_wx_attendance_data(user, current_date)
self.sudo()._do_plan_save_wx_attendance_data(user, current_date)
- attendance_records = self.env['hr.attendance'].search([], limit=1)
- if attendance_records:
- attendance_records[0].labor_update()
+ # attendance_records = self.env['hr.attendance'].search([], limit=1)
+ # if attendance_records:
+ # attendance_records[0].labor_update()
return True
diff --git a/yuthon_hr_employee/models/yuthon_hr_department.py b/yuthon_hr_employee/models/yuthon_hr_department.py
index b0f0f1322..578309e50 100644
--- a/yuthon_hr_employee/models/yuthon_hr_department.py
+++ b/yuthon_hr_employee/models/yuthon_hr_department.py
@@ -9,6 +9,7 @@ class YuthonHrDepartment(models.Model):
_rec_name = 'name'
_order = 'department_code asc'
+ name = fields.Char(string="部门名称", tracking=True, required=True)
department_phone = fields.Char(string="部门电话")
department_fax = fields.Char(string="部门传真")
department_location = fields.Char(string="部门地址")
@@ -95,4 +96,45 @@ class YuthonHrDepartment(models.Model):
old_suffix = employee.number[-2:]
employee.number = record.department_code + old_suffix
+ def open_record(self):
+ return {
+ "type": "ir.actions.act_window",
+ "res_model": 'hr.department',
+ "res_id": self.id,
+ "name":"部门详情",
+ "view_mode": "form",
+ }
+
+ def put_department_change(self):
+ form_id = self.env.ref('yuthon_hr_employee_approval.view_yuthon_department_change_form').id
+ department_list = []
+ for record in self:
+ department_list.append([0, 0, {'department_id': record.id,}])
+ return {
+ "type": "ir.actions.act_window",
+ "name": "部门变成审批",
+ "res_model": "yuthon.department.change",
+ "views": [[form_id, "form"]],
+ "context": {
+ 'default_approval_ids': department_list,
+ }
+ }
+
+ def all_put_department_change(self):
+ department_list = []
+ department_ids = self.env["hr.department"].browse(
+ self._context.get('active_ids', self._context.get('active_id')))
+ for record in department_ids:
+ department_list.append([0, 0, {'department_id': record.id,}])
+ form_id = self.env.ref('yuthon_hr_employee_approval.view_yuthon_department_change_form').id
+ return {
+ "type": "ir.actions.act_window",
+ "name": "部门变成审批",
+ "res_model": "yuthon.department.change",
+ "views": [[form_id, "form"]],
+ "context": {
+ 'default_approval_ids': department_list,
+ }
+ }
+
diff --git a/yuthon_hr_employee/views/yuthon_hr_department_views.xml b/yuthon_hr_employee/views/yuthon_hr_department_views.xml
index 9787df868..394935c82 100644
--- a/yuthon_hr_employee/views/yuthon_hr_department_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_department_views.xml
@@ -14,6 +14,11 @@
20
True
+
+
+
+
+
1
@@ -36,6 +41,8 @@
+
+
diff --git a/yuthon_hr_employee_approval/__manifest__.py b/yuthon_hr_employee_approval/__manifest__.py
index 7be7f83e6..3d8f52370 100644
--- a/yuthon_hr_employee_approval/__manifest__.py
+++ b/yuthon_hr_employee_approval/__manifest__.py
@@ -35,6 +35,7 @@
'views/yuthon_reassignment_approval_views.xml',
'views/yuthon_recruitment_approval_views.xml',
'views/yuthon_regularization_approval_views.xml',
+ 'views/yuthon_department_change_viwes.xml',
'views/yuthon_reward_approval_views.xml',
'views/yuthon_salary_approval_views.xml',
'views/yuthon_service_approval_views.xml',
diff --git a/yuthon_hr_employee_approval/data/process_code_data.xml b/yuthon_hr_employee_approval/data/process_code_data.xml
index f4efb7b68..b80d55f63 100644
--- a/yuthon_hr_employee_approval/data/process_code_data.xml
+++ b/yuthon_hr_employee_approval/data/process_code_data.xml
@@ -134,4 +134,11 @@
3
+
+ 部门变更审批-编号
+ yuthon_department_change_code
+ BM%(y)s%(month)s%(day)s
+ 3
+
+
diff --git a/yuthon_hr_employee_approval/models/__init__.py b/yuthon_hr_employee_approval/models/__init__.py
index b90af40a2..7563ddd67 100644
--- a/yuthon_hr_employee_approval/models/__init__.py
+++ b/yuthon_hr_employee_approval/models/__init__.py
@@ -22,4 +22,5 @@ from . import yuthon_social_files_approval
from . import yuthon_appointment_approval
from . import yuthon_transfer_approval
from . import yuthon_retired_approval
-from . import property_reimbursement_form
\ No newline at end of file
+from . import property_reimbursement_form
+from . import yuthon_department_change
\ No newline at end of file
diff --git a/yuthon_hr_employee_approval/models/yuthon_department_change.py b/yuthon_hr_employee_approval/models/yuthon_department_change.py
new file mode 100644
index 000000000..a9256b9cd
--- /dev/null
+++ b/yuthon_hr_employee_approval/models/yuthon_department_change.py
@@ -0,0 +1,58 @@
+from odoo import models, fields, api
+from odoo.exceptions import UserError
+
+
+class YuthonDepartmentChange(models.Model):
+ _name = 'yuthon.department.change'
+ _description = '部门变更审批'
+ _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
+
+ code = fields.Char(string='编号', required=True, copy=False,
+ default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_department_change_code'))
+ name = fields.Char(string="标题")
+ user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
+ department_id = fields.Many2one(related='user_id.department_id', string="部门")
+ is_issues = fields.Boolean(string='是否上会')
+ issues_result = fields.Html(string="会议结果")
+ related_issues_id = fields.Many2one('issue.library', string="关联议题")
+ reason_application = fields.Html(string="申请事由")
+ documents_ids = fields.Many2many('ir.attachment', string="附件")
+ active = fields.Boolean('Active', default=True)
+ urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
+ default='normal')
+ work_end = fields.Boolean(string="结束")
+ approval_ids = fields.One2many('department.change.approval.line', 'department_change_id', string="部门变更审批明细")
+
+ def _get_default_name_title(self):
+ return self._description if self._description else self._name
+
+ name_title = fields.Char(default=_get_default_name_title)
+
+ @api.onchange('is_issues')
+ def _onchange_is_issues(self):
+ if self.is_issues:
+ issue_id = self.env['issue.library'].create({'name': self.name})
+ self.related_issues_id = issue_id.id
+ workflow_record_id = self.env["soong.workflow.record"].search(
+ [("res_model", "=", self._name), ("res_id", "=", self.id)])
+ self.env['issue.library.approval.line'].create({
+ 'issue_library_id': issue_id.id,
+ 'workflow_record_id': workflow_record_id.id,
+ 'approval_type': workflow_record_id.workflow_id.id,
+ 'code': self.code,
+ 'approval_date': fields.Datetime.now(),
+ })
+
+ def approval_end(self):
+ for record in self:
+ for approval in record.approval_ids:
+ approval.department_id.write({'name': approval.new_name})
+
+class DepartmentChangeApprovalLine(models.Model):
+ _name = 'department.change.approval.line'
+ _description = '部门变更审批明细'
+
+ department_change_id = fields.Many2one('yuthon.department.change', string='关联部门变更')
+ department_id = fields.Many2one('hr.department', string='部门')
+ name = fields.Char(related='department_id.name', string='原部门名称')
+ new_name = fields.Char(string='新部门名称')
\ No newline at end of file
diff --git a/yuthon_hr_employee_approval/security/ir.model.access.csv b/yuthon_hr_employee_approval/security/ir.model.access.csv
index 9086d0217..d7eea8e7c 100644
--- a/yuthon_hr_employee_approval/security/ir.model.access.csv
+++ b/yuthon_hr_employee_approval/security/ir.model.access.csv
@@ -48,3 +48,5 @@ access_yuthon_retired_approval,yuthon_retired_approval,model_yuthon_retired_appr
access_yuthon_handover_line,yuthon_handover_line,model_yuthon_handover_line,base.group_user,1,1,1,1
access_yuthon_return_line,yuthon_return_line,model_yuthon_return_line,base.group_user,1,1,1,1
access_yuthon_goods_line,yuthon_goods_line,model_yuthon_goods_line,base.group_user,1,1,1,1
+access_yuthon_department_change, yuthon_department_change,model_yuthon_department_change,base.group_user,1,1,1,1
+access_department_change_approval_line,department_change_approval_line,model_department_change_approval_line,base.group_user,1,1,1,1
diff --git a/yuthon_hr_employee_approval/views/yuthon_department_change_viwes.xml b/yuthon_hr_employee_approval/views/yuthon_department_change_viwes.xml
new file mode 100644
index 000000000..fc77f9568
--- /dev/null
+++ b/yuthon_hr_employee_approval/views/yuthon_department_change_viwes.xml
@@ -0,0 +1,78 @@
+
+
+
+ yuthon.department.change.tree
+ yuthon.department.change
+
+
+
+
+
+
+
+
+
+ yuthon.department.change.form
+ yuthon.department.change
+
+
+
+
+
+ 部门变更审批
+ yuthon.department.change
+ tree,form
+
+
\ No newline at end of file
diff --git a/yuthon_salary/wizard/salary_print_wizard.py b/yuthon_salary/wizard/salary_print_wizard.py
index 1de49be4d..66fa437c5 100644
--- a/yuthon_salary/wizard/salary_print_wizard.py
+++ b/yuthon_salary/wizard/salary_print_wizard.py
@@ -24,6 +24,13 @@ class SalaryPrintWizard(models.Model):
('11', '11月份'),
('12', '12月份')
], string="月份", default=lambda self: str(datetime.datetime.now().month))
+ password = fields.Char(string='密码')
+
+ @api.onchange('password')
+ def _check_password(self):
+ login = self.env.user.login
+ if self.password != login:
+ raise ValidationError('密码错误!')
def print_fixed_report(self):
fields_list = [
diff --git a/yuthon_salary/wizard/salary_print_wizard_views.xml b/yuthon_salary/wizard/salary_print_wizard_views.xml
index e077f1fd7..9a9dd19c1 100644
--- a/yuthon_salary/wizard/salary_print_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_print_wizard_views.xml
@@ -9,6 +9,7 @@
+