Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import sale_order

View File

@@ -0,0 +1,36 @@
# Copyright 2020 ACSONE SA/NV
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
payment_transaction_count = fields.Integer(
string="Number of payment transactions",
compute="_compute_payment_transaction_count",
)
@api.depends("transaction_ids")
def _compute_payment_transaction_count(self):
for rec in self:
rec.payment_transaction_count = len(rec.transaction_ids)
def action_view_transaction(self):
action = {
"type": "ir.actions.act_window",
"name": "Payment Transactions",
"res_model": "payment.transaction",
}
if self.payment_transaction_count == 1:
action.update({"res_id": self.transaction_ids.id, "view_mode": "form"})
else:
action.update(
{
"view_mode": "list,form",
"domain": [("id", "in", self.transaction_ids.ids)],
}
)
return action