38 lines
1.6 KiB
Python
38 lines
1.6 KiB
Python
# Copyright 2017-19 ForgeFlow S.L. (https://www.forgeflow.com)
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
|
|
import pytz
|
|
|
|
from odoo import _, api, fields, models
|
|
from odoo.exceptions import ValidationError
|
|
|
|
|
|
class SoongWorkflowLog(models.Model):
|
|
_name = "soong.workflow.log"
|
|
_description = "Soong Workflow Log"
|
|
|
|
_sql_constraints = [(
|
|
"uniq_node_btn_id",
|
|
"unique(model, res_id, node_btn_id)",
|
|
_("Workflow log must be unique."),), ]
|
|
|
|
name = fields.Char(string="节点名称", compute="_compute_name")
|
|
model = fields.Char(string="Related Document Model", index=True, required=True)
|
|
res_id = fields.Integer(string="Related Document ID", index=True, required=True)
|
|
workflow_id = fields.Many2one(comodel_name="soong.workflow", related="node_btn_id.workflow_id")
|
|
node_id = fields.Many2one(comodel_name="soong.workflow.node", related="node_btn_id.node_id")
|
|
node_btn_id = fields.Many2one(comodel_name="soong.workflow.node.button", required=True, string="动作名称")
|
|
|
|
done_by = fields.Many2one(comodel_name="res.users", string="审批人")
|
|
lase_click_date = fields.Datetime(string="操作时间")
|
|
comment = fields.Char(string="意见")
|
|
|
|
@api.depends("workflow_id", "node_id", "node_btn_id")
|
|
def _compute_name(self):
|
|
for rec in self:
|
|
rec.name = "%(workflow_id_name)s - %(node_id_name)s - %(node_btn_name)s" % {
|
|
"workflow_id_name": rec.workflow_id.name,
|
|
"node_id_name": rec.node_id.name,
|
|
"node_btn_name": rec.node_btn_id.name,
|
|
}
|