From ae24d715ba13b5fbae0c42de505a1cde3fd7396b Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Tue, 3 Jan 2023 10:27:29 +0100
Subject: [PATCH] [fix] fix errors due to account_payment_order module changes

---
 models/account_payment_order.py | 3 ++-
 views/account_payment_order.xml | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/models/account_payment_order.py b/models/account_payment_order.py
index 2a3868b..a28cef7 100644
--- a/models/account_payment_order.py
+++ b/models/account_payment_order.py
@@ -33,7 +33,8 @@ class AccountPaymentOrder(models.Model):
 
     def _compute_bank_line_amount(self):
         for po in self:
-            po.bank_line_amount = sum(po.bank_line_ids.mapped("amount_currency"))
+            po.bank_line_amount = sum(po.payment_ids.filtered(
+                lambda p: not p.reversed_entry_id).mapped("amount_total_signed"))
 
     def _compute_attachment_ids(self):
         Attachment = self.env["ir.attachment"]
diff --git a/views/account_payment_order.xml b/views/account_payment_order.xml
index 3a21dd4..49d8257 100644
--- a/views/account_payment_order.xml
+++ b/views/account_payment_order.xml
@@ -78,7 +78,7 @@
                     </div>
                 </xpath>
                 <!-- Sheet Buttons -->
-                <xpath expr="//field[@name='bank_line_count']" position="after">
+                <xpath expr="//field[@name='payment_count']" position="after">
                     <field name="payment_line_amount" />
                     <field name="bank_line_amount" />
                     <button
-- 
GitLab