Files
public/directive_test/models/account_payment.py

32 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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