mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_payment_order: Add hook method for finding previous payment orders
This commit is contained in:
@@ -110,6 +110,10 @@ Contributors
|
|||||||
* Carlos Dauden
|
* Carlos Dauden
|
||||||
* Carlos Roca
|
* Carlos Roca
|
||||||
|
|
||||||
|
* `Open Source Integrators <https://www.opensourceintegrators.com>`_:
|
||||||
|
|
||||||
|
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ class AccountMove(models.Model):
|
|||||||
# in account_payment_order.py
|
# in account_payment_order.py
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
|
def get_account_payment_domain(self, payment_mode):
|
||||||
|
return [("payment_mode_id", "=", payment_mode.id), ("state", "=", "draft")]
|
||||||
|
|
||||||
def create_account_payment_line(self):
|
def create_account_payment_line(self):
|
||||||
apoo = self.env["account.payment.order"]
|
apoo = self.env["account.payment.order"]
|
||||||
result_payorder_ids = []
|
result_payorder_ids = []
|
||||||
@@ -81,11 +84,7 @@ class AccountMove(models.Model):
|
|||||||
raise UserError(_("No Payment Mode on invoice %s") % move.name)
|
raise UserError(_("No Payment Mode on invoice %s") % move.name)
|
||||||
for payment_mode in payment_modes:
|
for payment_mode in payment_modes:
|
||||||
payorder = apoo.search(
|
payorder = apoo.search(
|
||||||
[
|
self.get_account_payment_domain(payment_mode), limit=1
|
||||||
("payment_mode_id", "=", payment_mode.id),
|
|
||||||
("state", "=", "draft"),
|
|
||||||
],
|
|
||||||
limit=1,
|
|
||||||
)
|
)
|
||||||
new_payorder = False
|
new_payorder = False
|
||||||
if not payorder:
|
if not payorder:
|
||||||
|
|||||||
@@ -23,3 +23,7 @@
|
|||||||
* Pedro M. Baeza
|
* Pedro M. Baeza
|
||||||
* Carlos Dauden
|
* Carlos Dauden
|
||||||
* Carlos Roca
|
* Carlos Roca
|
||||||
|
|
||||||
|
* `Open Source Integrators <https://www.opensourceintegrators.com>`_:
|
||||||
|
|
||||||
|
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||||
|
|||||||
@@ -456,6 +456,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||||||
<li>Carlos Roca</li>
|
<li>Carlos Roca</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
|
||||||
|
<li>Ammar Officewala <<a class="reference external" href="mailto:aofficewala@opensourceintegrators.com">aofficewala@opensourceintegrators.com</a>></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
|
|||||||
Reference in New Issue
Block a user