From 1ffdf5e371067807e2439f9c8328581544b5106f Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 8 Nov 2022 13:36:46 +0100 Subject: [PATCH] [REF] account_reconcile_payment_order: Adapt module to native payment refactoring Following OCA/bank-payment#979 --- account_reconcile_payment_order/__manifest__.py | 2 +- .../models/account_reconciliation_widget.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/account_reconcile_payment_order/__manifest__.py b/account_reconcile_payment_order/__manifest__.py index 6aa4bbd3..dcdc4953 100644 --- a/account_reconcile_payment_order/__manifest__.py +++ b/account_reconcile_payment_order/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Reconcile payment orders", - "version": "14.0.1.0.0", + "version": "14.0.2.0.0", "author": "Therp BV, Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/account-reconcile", diff --git a/account_reconcile_payment_order/models/account_reconciliation_widget.py b/account_reconcile_payment_order/models/account_reconciliation_widget.py index 57539d0e..d51992f9 100644 --- a/account_reconcile_payment_order/models/account_reconciliation_widget.py +++ b/account_reconcile_payment_order/models/account_reconciliation_widget.py @@ -23,14 +23,15 @@ class AccountReconciliationWidget(models.AbstractModel): def _get_reconcile_lines_from_order(self, st_line, order, excluded_ids=None): """Return lines to reconcile our statement line with.""" aml_obj = self.env["account.move.line"] - reconciled_lines = aml_obj.search( - [("bank_payment_line_id", "in", order.bank_line_ids.ids)] + lines = aml_obj + for payment in order.payment_ids: + lines |= payment.move_id.line_ids.filtered( + lambda x: x.account_id != payment.destination_account_id + and x.partner_id == payment.partner_id + ) + return (lines - aml_obj.browse(excluded_ids)).filtered( + lambda x: not x.reconciled ) - return ( - reconciled_lines.mapped("move_id.line_ids") - - reconciled_lines - - aml_obj.browse(excluded_ids) - ).filtered(lambda x: not x.reconciled) def _prepare_proposition_from_orders(self, st_line, orders, excluded_ids=None): """Fill with the expected format the reconciliation proposition