Public release from ruodoo-project: 19.0 - 2026-07-26 21:17:35 UTC
This commit is contained in:
32
directive_test/models/account_payment.py
Normal file
32
directive_test/models/account_payment.py
Normal file
@ -0,0 +1,32 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_name = 'account.payment'
|
||||
_inherit = ["account.payment", "directive.mixin"]
|
||||
|
||||
def _directive_generation_spec(self):
|
||||
return [
|
||||
{
|
||||
"event": "on_write",
|
||||
"key": "pay_bank_trigger",
|
||||
"field": "state",
|
||||
"from": "draft",
|
||||
"to": "in_process",
|
||||
"use_record_template_group": True,
|
||||
"mode": "create_once",
|
||||
# Только для исходящих платежей
|
||||
"domain": [("payment_type", "=", "outbound")],
|
||||
}
|
||||
]
|
||||
|
||||
def action_bank_gateway_response(self, payload: dict):
|
||||
for pay in self:
|
||||
bank_ref = f"REF-{pay.id}-X99"
|
||||
|
||||
pay.message_post(
|
||||
body=f"Bank Gateway: Платеж отправлен в банк."
|
||||
f"Bank Reference: {bank_ref}"
|
||||
f"Комиссия агента: 0.00 у.е."
|
||||
)
|
||||
return True
|
||||
Reference in New Issue
Block a user