odex25_standard/odex25_takaful/odex_takaful/models/account_payment.py

38 lines
1.4 KiB
Python

from odoo import models, fields, api
class AccountPayment(models.Model):
_inherit = 'account.payment'
takaful_sponsorship_id = fields.Many2one(related="move_id.takaful_sponsorship_id")
branch_custom_id = fields.Many2one(
'branch.settings',
string="Branch",
related='takaful_sponsorship_id.branch_custom_id',
store=True,
readonly=True
)
payment_method_name = fields.Char(
string="Payment Method Name",
compute='_compute_payment_method_name',
store=True,
readonly=True,
help="Stored payment method name for grouping purposes"
)
confirm_payment_refund = fields.Binary()
IBN_number = fields.Integer()
confirm_payment_refund_image = fields.Binary()
payment_method_line_id_type = fields.Selection(related='journal_id.type')
machine_id = fields.Many2one('payment.machine', string='Payment Machine')
machine_reference = fields.Char(string='Machine Reference', help='Reference number from the payment machine')
@api.depends('payment_method_line_id', 'payment_method_line_id.name')
def _compute_payment_method_name(self):
for rec in self:
rec.payment_method_name = rec.payment_method_line_id.name if rec.payment_method_line_id else False
class AccountJournal(models.Model):
_inherit = 'account.journal'
branch_ids = fields.Many2many('branch.settings', string="Branchs")