Skip to content

Commit

Permalink
[IMP] block payment when payment transaction is pending (inherit _has…
Browse files Browse the repository at this point in the history
…_to_be_paid)

closes #396

Signed-off-by: augusto-weiss <awe@adhoc.com.ar>
  • Loading branch information
maq-adhoc authored and augusto-weiss committed Sep 13, 2023
1 parent 2fbe53b commit 61bf54a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_payment_ux/models/__init__.py
@@ -1,2 +1,3 @@
from . import account_payment
from . import payment_transaction
from . import account_move
9 changes: 9 additions & 0 deletions account_payment_ux/models/account_move.py
@@ -0,0 +1,9 @@
from odoo import models


class AccountMove(models.Model):
_inherit = 'account.move'

def _has_to_be_paid(self):
pending_transactions = self.transaction_ids.filtered(lambda tx: tx.state in ('pending') and tx.provider_code not in ['manual', 'transfer'])
return not pending_transactions and super()._has_to_be_paid()

0 comments on commit 61bf54a

Please sign in to comment.