添加功能

This commit is contained in:
李鹏宇
2026-01-07 15:11:04 +08:00
parent 02dbfc225f
commit 80e13f052e
3 changed files with 22 additions and 24 deletions
+17 -19
View File
@@ -87,7 +87,6 @@ class SoongWorkflowMixin(models.AbstractModel):
def _compute_is_back(self):
for record in self:
record.is_back = False
current_state = record.state
if not current_state or not record.log_ids:
continue
@@ -105,6 +104,8 @@ class SoongWorkflowMixin(models.AbstractModel):
)
if has_handling_log or has_handling_log2:
record.is_back = False
else:
record.is_back = True
def _compute_is_confirm(self):
for record in self:
@@ -119,9 +120,6 @@ class SoongWorkflowMixin(models.AbstractModel):
if lg1:
record.is_end = False
@api.depends("node_id", "log_ids")
def _compute_approval_sign_ids(self):
for record in self:
@@ -775,21 +773,21 @@ class SoongWorkflowMixin(models.AbstractModel):
wkf_rec = wkf_obj.search([("model_id", "=", model), ('is_enable', '=', True)])
for node in wkf_rec.node_ids:
for button in node.button_ids:
if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
btn_exec_action_el = etree.SubElement(header_el, "button")
btn_exec_action_el.set("name", "btn_exec_action")
btn_exec_action_el.set("string", button.name)
btn_exec_action_el.set("type", "object")
if button.is_highlight:
btn_exec_action_el.set("class", "oe_highlight")
if button.has_icon:
btn_exec_action_el.set("icon", button.icon)
invisible_condition = "state != '%s'" % node.node_name
if model == 'purchase.order':
invisible_condition = invisible_condition.replace("询价", "draft")
btn_exec_action_el.set("invisible", invisible_condition)
btn_exec_action_el.set("context","{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name), )
else:
# if self.env.user.has_group("soong_workflow.group_soong_workflow_manager"):
# btn_exec_action_el = etree.SubElement(header_el, "button")
# btn_exec_action_el.set("name", "btn_exec_action")
# btn_exec_action_el.set("string", button.name)
# btn_exec_action_el.set("type", "object")
# if button.is_highlight:
# btn_exec_action_el.set("class", "oe_highlight")
# if button.has_icon:
# btn_exec_action_el.set("icon", button.icon)
# invisible_condition = "state != '%s'" % node.node_name
# if model == 'purchase.order':
# invisible_condition = invisible_condition.replace("询价", "draft")
# btn_exec_action_el.set("invisible", invisible_condition)
# btn_exec_action_el.set("context","{'btn_key':'%s','active_model':'%s'}" % (button.btn_key, self._name), )
# else:
is_apostille = False
if button.btn_hide:
if button.review_type == "individual":
@@ -327,15 +327,15 @@ class SoongWorkflowCommentWizard(models.TransientModel):
return self.env['hr.employee'] # 默认返回空记录集
def add_comment(self):
has_comment_note = bool(self.comment_note_id)
has_comment = bool(self.comment and self.comment.strip())
if not has_comment_note and not has_comment:
raise UserError('请填写备注')
self.ensure_one()
cx = self.env.context.copy() or {}
record_id = self.env[self.res_model].search([('id', '=', self.res_id)])
is_admin = self.env.user.has_group('soong_workflow.group_soong_workflow_manager')
if self.node_btn_name == '转交':
has_comment_note = bool(self.comment_note_id)
has_comment = bool(self.comment and self.comment.strip())
if not has_comment_note and not has_comment:
raise UserError('请填写备注')
self_node_id = record_id.workflow_id.node_ids.search(
[('name', '=', record_id.state), ('workflow_id', '=', record_id.workflow_id.id)])
log = self.env['soong.workflow.log'].search([("model", "=", self.res_model),
@@ -91,7 +91,7 @@
<group invisible="node_btn_name != '分发'">
<field name="employee_ids" widget="many2many_tags" string="董事长" domain="[('user_role_id.name', '=', '董事长')]" options="{'no_create': True}" groups="yuthon_salary.group_jtbb_user"/>
<field name="dep_manager_employee_ids" widget="many2many_tags" string="承办" domain="[('user_role_id.name', '!=', '部门经理')]" options="{'no_create': True}"/>
<field name="dep_manager_employee_ids" widget="many2many_tags" string="承办" domain="[('user_role_id.name', '=', '部门经理')]" options="{'no_create': True}"/>
<field name="circulated_employee_ids" widget="many2many_tags" options="{'no_create': True}" domain = "[('company_id', '=', company_id), ('user_role_id.name', '!=', '部门经理')]"/>
<field name="supervising_employee_ids" widget="many2many_tags" invisible="not is_supervising" options="{'no_create': True}"/>
</group>