From 49b55ed42a3fa7ba8b7f2188de549f14dc9ea58d Mon Sep 17 00:00:00 2001 From: AmmarOfficewalaSerpentCS Date: Fri, 9 Jul 2021 19:26:03 +0530 Subject: [PATCH] [FIX] Fixed issued of a reconcie functionlity. --- .../models/bank_payment_line.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/account_banking_ach_discount/models/bank_payment_line.py b/account_banking_ach_discount/models/bank_payment_line.py index 222c6734..5cb597fd 100644 --- a/account_banking_ach_discount/models/bank_payment_line.py +++ b/account_banking_ach_discount/models/bank_payment_line.py @@ -24,4 +24,16 @@ def _compute_discount_amount(self): for bline in self: discount_amount = sum(bline.mapped("payment_line_ids.discount_amount")) bline.discount_amount = discount_amount + + def reconcile(self): + self.ensure_one() + amlo = self.env["account.move.line"] + transit_mlines = amlo.search([("bank_payment_line_id", "=", self.id)]) + for line in transit_mlines: + ap_mlines = line.move_id.line_ids.filtered( + lambda x: x.account_id == line.account_id + ) + lines_to_rec = line + lines_to_rec += ap_mlines + lines_to_rec.reconcile()