This commit is contained in:
李鹏宇
2026-01-18 17:25:00 +08:00
4 changed files with 59 additions and 0 deletions
+2
View File
@@ -46,6 +46,8 @@
'assets': {
'web.assets_backend': [
'soong_workflow/static/src/css/record_scss.scss',
'soong_workflow/static/src/css/button_css.scss',
'soong_workflow/static/src/js/view_button.js',
],
},
"installable": True,
@@ -896,32 +896,42 @@ class SoongWorkflowMixin(models.AbstractModel):
btn_invisible = self.sudo().env[button.workflow_id.model_id.model].search(domain).ids
invisible += " or id not in {0} ".format(str(btn_invisible))
if button.name == '确认':
btn_exec_action_el.set("class", "btn btn-confirm")
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += "or not is_confirm"
if button.name == '结束':
btn_exec_action_el.set("class", "btn btn-finish")
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += "or not is_end"
if button.name == "退回":
btn_exec_action_el.set("class", "btn btn-return")
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += " or not log_ids "
if button.name == "分发":
btn_exec_action_el.set("class", "btn btn-distribute")
invisible += " or is_send"
if button.name == "转交":
btn_exec_action_el.set("class", "btn btn-transfer")
if button.name == "收回":
btn_exec_action_el.set("class", "btn btn-recall")
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += " or not log_ids or not is_back"
if button.name == '归档':
btn_exec_action_el.set("class", "btn btn-archive")
id_el = etree.Element("field")
id_el.set("name", "log_ids")
id_el.set("invisible", "1")
invisible += "or not is_active"
custom_class = btn_exec_action_el.get("class", "")
btn_exec_action_el.set("class", custom_class)
if model == 'purchase.order':
invisible = invisible.replace("询价", "draft")
btn_exec_action_el.set("invisible", invisible)
@@ -0,0 +1,31 @@
/* Odoo 流程按钮 转交/收回/结束/确认/分发/退回 专用样式 - 完整最终版 */
/* 公共基础样式:统一大小、间距、圆角、加粗,醒目+不拥挤,适配Odoo表单头部 */
.o_form_button.btn-flow {
min-width: 96px !important;
height: 38px !important;
margin: 0 3px !important;
border-radius: 5px !important;
font-size: 13px !important;
font-weight: bold !important;
border: 0 !important;
}
/* 鼠标悬浮统一特效:放大+阴影+亮一点,层次感拉满,必加 */
.o_form_button.btn-flow:hover {
transform: scale(1.02);
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
filter: brightness(1.05);
transition: all 0.2s ease;
}
/* 确认按钮 - 主色深蓝 最醒目【核心操作】 */
.btn-confirm { background: #2563eb !important; color: #fff !important; }
/* 结束按钮 - 宝蓝色 权重高【完成操作】 */
.btn-finish { background: #1d4ed8 !important; color: #fff !important; }
/* 转交按钮 - 深绿色 友好【流转操作】 */
.btn-transfer { background: #166534 !important; color: #fff !important; }
/* 分发按钮 - 翠绿色 清爽【下发操作】 */
.btn-distribute { background: #16a34a !important; color: #fff !important; }
/* 收回按钮 - 暖橙色 提醒【轻度逆向】 */
.btn-recall { background: #f59e0b !important; color: #fff !important; }
/* 退回按钮 - 警示红 醒目【高危逆向】 */
.btn-return { background: #ef4444 !important; color: #fff !important; }
@@ -0,0 +1,16 @@
/** @odoo-module **/
import { ViewButton } from "@web/views/view_button/view_button";
import { patch } from "@web/core/utils/patch";
const WKF_BTN = "btn_exec_action";
patch(ViewButton.prototype, {
getClassName() {
const { className, clickParams } = this.props;
if (clickParams?.name !== WKF_BTN) {
return super.getClassName();
}
return className;
}
});