Skip to content

Commit 0559ab7

Browse files
maq-adhocrov-adhoc
authored andcommitted
[IMP] account_payment_ux: ignore pending invoices from _get_overdue_invoices_domain
closes #971 Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
1 parent 5669952 commit 0559ab7

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

account_payment_ux/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import models
2+
from . import controllers
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import portal
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from odoo.addons.account.controllers.portal import PortalAccount
2+
from odoo.http import request
3+
4+
5+
class PortalAccountInherit(PortalAccount):
6+
# Obtiene el dominio de facturas vencidas y excluye las que tienen
7+
# pagos online pendientes (no manual/transferencia); esta busqueda
8+
# es necesaria porque el usuario portal no accede a payment.transaction.
9+
def _get_overdue_invoices_domain(self, partner_id=None):
10+
domain = super()._get_overdue_invoices_domain(partner_id=partner_id)
11+
move_ids = request.env["account.move"].search(domain).ids
12+
ignored_moves = (
13+
request.env["payment.transaction"]
14+
.sudo()
15+
.search(
16+
[
17+
("invoice_ids", "in", move_ids),
18+
("provider_code", "not in", ["manual", "transfer"]),
19+
("state", "=", "pending"),
20+
]
21+
)
22+
.mapped("invoice_ids")
23+
.ids
24+
)
25+
if ignored_moves:
26+
domain += [("id", "not in", ignored_moves)]
27+
return domain

0 commit comments

Comments
 (0)