Files
gzth/soong_workflow/wizard/soong_workflow_comment_wizard.py
T
2024-08-29 22:04:00 +08:00

23 lines
728 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 = fields.Char(required=True)
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()