diff --git a/yuthon_official/models/official_category.py b/yuthon_official/models/official_category.py
index 4470ef340..d7629bcb6 100644
--- a/yuthon_official/models/official_category.py
+++ b/yuthon_official/models/official_category.py
@@ -34,5 +34,5 @@ class ApprovalRequest(models.Model):
main_flats = fields.Char(string="主送")
urgency = fields.Selection([('normal', '一般'), ('urgent', '紧急'), ('extra_urgent', '特急')], string="紧急程度")
secret_level = fields.Selection([('normal', '一般'), ('urgent', '秘密'), ('secret', '机密'), ('so_secret', '绝密')], string="密级")
- date = fields.Datetime(string="日期")
+ date = fields.Datetime(string="日期", default=fields.Datetime.now)
diff --git a/yuthon_wechat/models/hr_employee.py b/yuthon_wechat/models/hr_employee.py
index 1017d4d77..2bb3d866b 100644
--- a/yuthon_wechat/models/hr_employee.py
+++ b/yuthon_wechat/models/hr_employee.py
@@ -25,11 +25,13 @@ class HrDepartment(models.Model):
wecom_department_id=record.wecom_id,
name=record.name,
name_en=record.wecom_name_en,
- parentid=record.wecom_parent_id,
+ parentid=record.wecom_parent_id if record.wecom_parent_id else record.parent_id.wecom_id,
)
if not result_status:
sync_flag = False
sync_content = sync_content + record.name + ":" + result_content + ";\n"
+ else:
+ record.wecom_id = result_content.get("id", 0)
if not sync_flag:
raise UserError(str(sync_content))
diff --git a/yuthon_wechat/models/wecom_apps.py b/yuthon_wechat/models/wecom_apps.py
index 1ba7f7952..88c1812ed 100644
--- a/yuthon_wechat/models/wecom_apps.py
+++ b/yuthon_wechat/models/wecom_apps.py
@@ -129,5 +129,5 @@ class WeComApps(models.Model):
else:
result_data = self.sync_function_api("user_create", "DEPARTMENT_CREATE", data)
if result_data.get("errcode", None) == 0:
- return True, result_data.get("errmsg", "")
+ return True, result_data
return False, result_data.get("errmsg", "")
diff --git a/yuthon_wechat/views/hr_employee_views.xml b/yuthon_wechat/views/hr_employee_views.xml
index af18907a7..3acf4b225 100644
--- a/yuthon_wechat/views/hr_employee_views.xml
+++ b/yuthon_wechat/views/hr_employee_views.xml
@@ -41,11 +41,15 @@
hr.department
-
+
+
+
+
+
@@ -56,7 +60,7 @@