This commit is contained in:
gsinghpal
2026-04-04 15:37:16 -04:00
parent c66bdf5089
commit 3cc93b8783
36 changed files with 3278 additions and 548 deletions

View File

@@ -0,0 +1,42 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, api, fields, models
class AccountPayment(models.Model):
_inherit = 'account.payment'
poynt_settlement_line_ids = fields.One2many(
'poynt.settlement.line',
'existing_payment_id',
string="Settlement Lines",
)
poynt_settlement_count = fields.Integer(
string="Settlements",
compute='_compute_poynt_settlement_count',
)
@api.depends('poynt_settlement_line_ids')
def _compute_poynt_settlement_count(self):
for payment in self:
payment.poynt_settlement_count = len(payment.poynt_settlement_line_ids)
def action_view_poynt_settlement(self):
"""Open the settlement batch linked to this payment."""
self.ensure_one()
batch_ids = self.poynt_settlement_line_ids.mapped('batch_id').ids
if len(batch_ids) == 1:
return {
'type': 'ir.actions.act_window',
'name': _("Settlement Batch"),
'res_model': 'poynt.settlement.batch',
'view_mode': 'form',
'res_id': batch_ids[0],
}
return {
'type': 'ir.actions.act_window',
'name': _("Settlement Batches"),
'res_model': 'poynt.settlement.batch',
'view_mode': 'list,form',
'domain': [('id', 'in', batch_ids)],
}