diff --git a/sh_backmate_theme_adv_enterprise/static/src/scss/sidebar/collapsed.scss b/sh_backmate_theme_adv_enterprise/static/src/scss/sidebar/collapsed.scss index 48f4299b7..b6129b258 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/scss/sidebar/collapsed.scss +++ b/sh_backmate_theme_adv_enterprise/static/src/scss/sidebar/collapsed.scss @@ -468,6 +468,12 @@ .logo { background: #fff; } + #company_logo { + display: none; + } + #company_name_logo { + margin: auto; + } /* =============== topbar ================= */ nav.o_main_navbar { diff --git a/sh_backmate_theme_adv_enterprise/static/src/views/form/form_controller.js b/sh_backmate_theme_adv_enterprise/static/src/views/form/form_controller.js index 9be4e165b..0ce09c23b 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/views/form/form_controller.js +++ b/sh_backmate_theme_adv_enterprise/static/src/views/form/form_controller.js @@ -39,6 +39,7 @@ patch(FormController.prototype, { }); // 监听resId变化 useEffect(() => { + console.log("[editButtonState] useEffect 触发, resId:", this.model?.root?.resId); this.editButtonState(); }, () => [this.model?.root?.resId]); // end edit @@ -94,37 +95,40 @@ patch(FormController.prototype, { async editButtonState() { this.buttonState.showEditButton = true; try { + console.log("[editButtonState] === 开始检查 ==="); + console.log("[editButtonState] isAdmin (session.is_system):", this.isAdmin); + if (this.isAdmin) { + console.log("[editButtonState] 管理员,直接显示编辑按钮"); this.buttonState.showEditButton = true; return; } + const resModel = this.model.config.resModel || this.model.root.resModel || this.props.resModel; const resId = this.model.config.resId || this.model.root.resId || this.props.resId; const currentUserId = this.env.services.user.userId; + console.log("[editButtonState] resModel:", resModel, "| resId:", resId, "| currentUserId:", currentUserId, "(session.uid:", session.uid, ")"); + if (resModel && resId) { - // 1. 判断 self_users_ids(经办人)— 不依赖 view fields,直接 ORM 读取 - // 因为 self_users_ids 可能不在表单视图里渲染,fields 元数据会缺失 + // 1. 判断 self_users_ids(经办人)— 调用模型方法,避免触发 mixin 里 read() 的日志副作用 try { - const result = await this.orm.read(resModel, [resId], ["self_users_ids", "work_end"]); - const selfUsers = result[0]?.self_users_ids || []; - // 经办人列表有值时,当前用户不在里面就隐藏编辑按钮 - if (selfUsers.length > 0 && !selfUsers.includes(currentUserId)) { - this.buttonState.showEditButton = false; - return; - } - // 2. work_end 判断(同一次 ORM 读取,减少请求) - if (result[0]?.work_end === true) { + const state = await this.orm.call(resModel, "get_edit_button_state", [[resId]]); + console.log("[editButtonState] get_edit_button_state 返回:", JSON.stringify(state)); + if (state && state.show_edit === false) { + console.log("[editButtonState] ❌ 不是经办人或流程已结束,隐藏编辑按钮"); this.buttonState.showEditButton = false; return; } } catch (e) { - // 模型没有 self_users_ids / work_end 字段,跳过检查,正常显示编辑按钮 + console.log("[editButtonState] get_edit_button_state 调用失败(模型可能没有该方法):", e?.message || e); } - // 3. 以上条件都不满足,显示编辑按钮 + console.log("[editButtonState] ✅ 显示编辑按钮"); this.buttonState.showEditButton = true; + } else { + console.log("[editButtonState] resModel 或 resId 为空,跳过检查,显示编辑按钮"); } } catch (error) { - console.error("检查编辑按钮状态:", error); + console.error("[editButtonState] 检查编辑按钮状态出错:", error); this.buttonState.showEditButton = true; } } diff --git a/soong_workflow/models/soong_workflow_mixin.py b/soong_workflow/models/soong_workflow_mixin.py index 644426afc..f216a8564 100644 --- a/soong_workflow/models/soong_workflow_mixin.py +++ b/soong_workflow/models/soong_workflow_mixin.py @@ -27,6 +27,29 @@ class SoongWorkflowMixin(models.AbstractModel): target_logs.write({'approval_state': '1'}) return super(SoongWorkflowMixin, self).read(fields=fields, load=load) + def get_edit_button_state(self): + """供前端判断编辑按钮是否显示,避免触发 read() 重写里的日志副作用。""" + self.ensure_one() + # 没有 self_users_ids / work_end 字段的模型不做限制 + if not hasattr(self, 'self_users_ids') or not hasattr(self, 'work_end'): + return {'show_edit': True} + is_current_user = self.env.user.id in self.self_users_ids.ids + # is_modify=True 且当前用户是流程创建人时也允许编辑 + is_modify_creator = False + if hasattr(self, 'is_modify') and self.is_modify: + workflow_record = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id), ('reclaim_state', '=', False)], limit=1) + if workflow_record and workflow_record.create_uid.id == self.env.user.id: + is_modify_creator = True + show_edit = (is_current_user and not self.work_end) or is_modify_creator + return { + 'show_edit': show_edit, + 'self_users_ids': self.self_users_ids.ids, + 'work_end': self.work_end, + 'is_modify': hasattr(self, 'is_modify') and self.is_modify, + 'is_modify_creator': is_modify_creator, + } + # @api.model # def write(self, vals): # res = super(SoongWorkflowMixin, self).write(vals) diff --git a/yuthon_base/views/ir_cron_act_views.xml b/yuthon_base/views/ir_cron_act_views.xml index fb301dc4d..0e0f8b98f 100644 --- a/yuthon_base/views/ir_cron_act_views.xml +++ b/yuthon_base/views/ir_cron_act_views.xml @@ -1,5 +1,6 @@ + + ir.cron.type.tree ir.cron.type