Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] block payment when payment transaction is pending (inherit _has…
…_to_be_paid) closes #396 Signed-off-by: augusto-weiss <awe@adhoc.com.ar>
- Loading branch information
1 parent
2fbe53b
commit 61bf54a
Showing
2 changed files
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import account_payment | ||
from . import payment_transaction | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |