Files
gzth/soong_workflow/wizard/soong_workflow_comment_wizard.py
T
2024-09-01 23:09:05 +08:00

25 lines
962 B
Python

# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class SoongWorkflowCommentWizard(models.TransientModel):
_name = "soong.workflow.comment.wizard"
_description = "Soong Workflow Comment Wizard"
res_model = fields.Char()
res_id = fields.Integer()
log_ids = fields.Many2many(comodel_name="soong.workflow.log")
node_btn_id = fields.Many2one(comodel_name="soong.workflow.node.button")
comment_note_id = fields.Many2one('soong.note', required=True, string="意见")
comment_type = fields.Selection(related="comment_note_id.type", string="意见类型")
comment_return_type = fields.Char(related="comment_note_id.return_type", string="退回类型")
def add_comment(self):
self.ensure_one()
cx = self.env.context.copy() or {}
self.log_ids.write({"comment": self.comment})
return self.node_btn_id.with_context(cx).run()