Public release from ruodoo-project: 19.0 - 2026-07-26 21:17:35 UTC
This commit is contained in:
32
directive_test/models/account_move.py
Normal file
32
directive_test/models/account_move.py
Normal file
@ -0,0 +1,32 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_name = "account.move"
|
||||
_inherit = ["account.move", "directive.mixin"]
|
||||
|
||||
|
||||
def _directive_generation_spec(self):
|
||||
return [
|
||||
{
|
||||
"event": "on_write",
|
||||
"key": "am_audit_trigger",
|
||||
"field": "state",
|
||||
"from": "draft",
|
||||
"to": "posted",
|
||||
"use_record_template_group": True,
|
||||
"mode": "create_once",
|
||||
# Генерируем только для входящих инвойсов от поставщиков
|
||||
"domain": [("move_type", "=", "in_invoice")],
|
||||
}
|
||||
]
|
||||
|
||||
def action_audit_response(self, payload: dict):
|
||||
"""
|
||||
Вызывается агентом-аудитором.
|
||||
"""
|
||||
for move in self:
|
||||
move.message_post(
|
||||
body=f"Audit Bot: Обнаружен риск, 30/100."
|
||||
f"Директива #{payload.get('directive_id')} завершена с предупреждением."
|
||||
)
|
||||
Reference in New Issue
Block a user