[IMP] account_payment_order: Add hook method for finding previous payment orders

This commit is contained in:
AmmarOfficewalaSerpentCS
2021-07-06 14:22:50 +05:30
parent e48e59d2ac
commit 1f4e943129
4 changed files with 16 additions and 5 deletions

View File

@@ -110,6 +110,10 @@ Contributors
* Carlos Dauden
* Carlos Roca
* `Open Source Integrators <https://www.opensourceintegrators.com>`_:
* Ammar Officewala <aofficewala@opensourceintegrators.com>
Maintainers
~~~~~~~~~~~

View File

@@ -49,6 +49,9 @@ class AccountMove(models.Model):
# in account_payment_order.py
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):
apoo = self.env["account.payment.order"]
result_payorder_ids = []
@@ -81,11 +84,7 @@ class AccountMove(models.Model):
raise UserError(_("No Payment Mode on invoice %s") % move.name)
for payment_mode in payment_modes:
payorder = apoo.search(
[
("payment_mode_id", "=", payment_mode.id),
("state", "=", "draft"),
],
limit=1,
self.get_account_payment_domain(payment_mode), limit=1
)
new_payorder = False
if not payorder:

View File

@@ -23,3 +23,7 @@
* Pedro M. Baeza
* Carlos Dauden
* Carlos Roca
* `Open Source Integrators <https://www.opensourceintegrators.com>`_:
* Ammar Officewala <aofficewala@opensourceintegrators.com>

View File

@@ -456,6 +456,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Carlos Roca</li>
</ul>
</li>
<li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
<li>Ammar Officewala &lt;<a class="reference external" href="mailto:aofficewala&#64;opensourceintegrators.com">aofficewala&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">