diff --git a/sh_backmate_theme_adv_enterprise/static/src/scss/form_view/form_view.scss b/sh_backmate_theme_adv_enterprise/static/src/scss/form_view/form_view.scss index c51520ef8..174ab857e 100644 --- a/sh_backmate_theme_adv_enterprise/static/src/scss/form_view/form_view.scss +++ b/sh_backmate_theme_adv_enterprise/static/src/scss/form_view/form_view.scss @@ -21,23 +21,28 @@ .o_action_manager .o_form_view_container .o_content .o_form_renderer .o_form_sheet_bg { max-width: 80%; margin: 0 auto; -} -.o_action_manager .o_form_view_container .o_content .o_form_renderer .o_form_sheet_bg .o_wrap_field .o_form_label { - width: 100px; - /* 固定宽度 */ - text-align: justify; - /* 启用两端对齐 */ - text-align-last: justify; - font-weight:700 !important; - opacity: 1 !important; - /* 最后一行也对齐 */ - /* 解决单行文本需触发对齐的问题 */ - &::after { - content: ''; - display: inline-block; - width: 100%; - /* 撑满宽度,触发对齐 */ + .o_form_sheet { + box-shadow: 0px 2px 11px 0px black; + } + + .o_wrap_field .o_form_label { + /* 固定宽度 */ + width: 100px; + /* 启用两端对齐 */ + text-align: justify; + /* 最后一行也对齐 */ + text-align-last: justify; + // 统一透明度 + opacity: 1 !important; + font-weight: 600; } } + +/* 添加红色星号在 label 后 */ +.o_wrap_field:has(.o_required_modifier) label.o_form_label::after { + content: "*"; + color: red; +} + //add end \ No newline at end of file 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 f48b6b06c..2d2c83459 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 @@ -95,26 +95,31 @@ patch(FormController.prototype, { // } // return true; // } - etitButtonState() { - const hasWorkEnd = this.model.config.fields.work_end ? this.model.config.fields.work_end : this.props.fields.work_end; - if (hasWorkEnd) { - const redModel = this.model.config.resModel ? this.model.config.resModel : this.props.resModel; - const resId = this.model.config.resId ? this.model.config.resId : this.props.resId; - if (redModel && resId) { - this.orm.read(redModel, [resId], ["work_end"]).then((records) => { - const record = records[0]; - if (record && record.work_end === true) { - this.buttonState.showEditButton = false; - } else { - this.buttonState.showEditButton = true; - } - }) - } else { - this.buttonState.showEditButton = true; + async etitButtonState() { + const fields = this.model.config.fields || this.props.fields; + const resModel = this.model.config.resModel || this.props.resModel; + const resId = this.model.config.resId || this.props.resId; + const currentUserId = this.env.services.user.userId; + // 默认显示按钮 + this.buttonState.showEditButton = true; + if (resModel && resId) { + // 1. 判断是否存在 self_users_ids(经办人)字段 + if (fields.self_users_ids) { + const result = await this.orm.read(resModel, [resId], ["self_users_ids"]); + const selfUsers = result[0]?.self_users_ids || []; + if (!selfUsers.includes(currentUserId)) { + this.buttonState.showEditButton = false; + return; // 如果不是经办人,直接返回 + } + } + // 2. 判断 work_end 字段是否存在,且是否为 true + if (fields.work_end) { + const result = await this.orm.read(resModel, [resId], ["work_end"]); + const record = result[0]; + if (record && record.work_end === true) { + this.buttonState.showEditButton = false; + } } - } else { - this.buttonState.showEditButton = true; } } -}) - +}) \ No newline at end of file