From 1f4e94312969cb7d983eda7256e19fa571ef8feb Mon Sep 17 00:00:00 2001 From: AmmarOfficewalaSerpentCS Date: Tue, 6 Jul 2021 14:22:50 +0530 Subject: [PATCH] [IMP] account_payment_order: Add hook method for finding previous payment orders --- account_payment_order/README.rst | 4 ++++ account_payment_order/models/account_move.py | 9 ++++----- account_payment_order/readme/CONTRIBUTORS.rst | 4 ++++ account_payment_order/static/description/index.html | 4 ++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/account_payment_order/README.rst b/account_payment_order/README.rst index 348adcfe7..29755b0ef 100644 --- a/account_payment_order/README.rst +++ b/account_payment_order/README.rst @@ -110,6 +110,10 @@ Contributors * Carlos Dauden * Carlos Roca +* `Open Source Integrators `_: + + * Ammar Officewala + Maintainers ~~~~~~~~~~~ diff --git a/account_payment_order/models/account_move.py b/account_payment_order/models/account_move.py index cf4c8d608..dc76fa093 100644 --- a/account_payment_order/models/account_move.py +++ b/account_payment_order/models/account_move.py @@ -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: diff --git a/account_payment_order/readme/CONTRIBUTORS.rst b/account_payment_order/readme/CONTRIBUTORS.rst index eb9d15318..acf4c751b 100644 --- a/account_payment_order/readme/CONTRIBUTORS.rst +++ b/account_payment_order/readme/CONTRIBUTORS.rst @@ -23,3 +23,7 @@ * Pedro M. Baeza * Carlos Dauden * Carlos Roca + +* `Open Source Integrators `_: + + * Ammar Officewala diff --git a/account_payment_order/static/description/index.html b/account_payment_order/static/description/index.html index 0c3d69411..307507d38 100644 --- a/account_payment_order/static/description/index.html +++ b/account_payment_order/static/description/index.html @@ -456,6 +456,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Carlos Roca
  • +
  • Open Source Integrators: +