Merge pull request !8773 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-02-07 11:16:18 +00:00
committed by Gitee
2 changed files with 30 additions and 1 deletions
+29
View File
@@ -60,6 +60,35 @@ class SoongWorkflow(models.Model):
employee_ids = fields.Many2many('hr.employee', string="人员")
role_ids = fields.Many2many('soong.user.role', 'soong_workflow_role_rel', 'workflow_id', 'user_role_id', string="角色")
def update_opinions(self):
soong_ids = self.env["soong.workflow"].browse(
self._context.get('active_ids', self._context.get('active_id')))
btn_opinion_map = {
'转交': ('transfer_comment_id', '拟同意,请审批。'),
'退回': ('return_comment_id', '请修改再报。'),
'确认': ('confirm_comment_id', '已阅。'),
'结束': ('end_comment_id', '同意。')
}
all_opinion_texts = [v[1] for v in btn_opinion_map.values()]
note_records = self.env['soong.note'].search([('name', 'in', all_opinion_texts)])
note_text_to_rec = {note.name: note for note in note_records}
for rec in soong_ids:
if not rec.node_ids:
continue
for node in rec.node_ids:
if not node.button_ids:
continue
for button in node.button_ids:
if button.name in btn_opinion_map:
field_name, opinion_text = btn_opinion_map[button.name]
note_rec = note_text_to_rec.get(opinion_text)
if not note_rec:
note_rec = self.env['soong.note'].create({'name': opinion_text})
note_text_to_rec[opinion_text] = note_rec
node.write({field_name: note_rec.id})
def change_opinions_wizard(self):
soong_ids = self.env["soong.workflow"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -4,7 +4,7 @@
<field name="name">yuthon.medical.manage.tree</field>
<field name="model">yuthon.medical.manage</field>
<field name="arch" type="xml">
<tree string="体检费管理" editable="bottom">
<tree string="体检费管理" editable="bottom" default_order="year desc">
<header>
<button name="property_reimbursement_form" string="提交体检费报销审批" type="object"
class="oe_highlight"/>