ljm 企业微信 部门更新新建

This commit is contained in:
李鹏宇
2024-07-14 19:16:46 +08:00
parent 91543534de
commit c7f4633d83
3 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -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))
+1 -1
View File
@@ -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", "")
+5 -1
View File
@@ -41,11 +41,15 @@
<field name="model">hr.department</field>
<field name="inherit_id" ref="hr.view_department_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="inside">
<xpath expr="//sheet" position="before">
<header>
<button class="oe_stat_button" name="send_wecom_employee" string="同步企业微信部门" groups="hr.group_hr_manager" type="object" icon="fa-bars"/>
</header>
</xpath>
<xpath expr="//field[@name='color']" position="after">
<field name="wecom_id" />
<field name="wecom_parent_id" />
</xpath>
</field>
</record>