details:   https://code.tryton.org/tryton/commit/02b0ee5ee874
branch:    default
user:      Adrià Tarroja Caubet <[email protected]>
date:      Mon Sep 28 12:19:07 2026 +0200
description:
        Filter receivable lines by mandate company

        The receivable-with-mandate tab must use the company of each move line,
        as payment processing does. A mandate of another company does not make
        the line collectible.

        Closes #15125
diffstat:

 modules/account_payment_sepa/account.py  |  30 ++++++++++++++++++++++++++++++
 modules/account_payment_sepa/account.xml |   2 +-
 modules/account_payment_sepa/tryton.cfg  |   1 +
 3 files changed, 32 insertions(+), 1 deletions(-)

diffs (70 lines):

diff -r 9a97a5df08ae -r 02b0ee5ee874 modules/account_payment_sepa/account.py
--- a/modules/account_payment_sepa/account.py   Wed Jul 29 18:13:09 2026 +0200
+++ b/modules/account_payment_sepa/account.py   Mon Sep 28 12:19:07 2026 +0200
@@ -1,6 +1,9 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 
+from sql import Literal
+from sql.operators import Exists
+
 from trytond.i18n import gettext
 from trytond.model import ModelSQL, fields
 from trytond.modules.company.model import CompanyValueMixin
@@ -31,6 +34,33 @@
             ])
 
 
+class MoveLine(metaclass=PoolMeta):
+    __name__ = 'account.move.line'
+
+    sepa_mandate_available = fields.Function(fields.Boolean(
+            "SEPA Mandate Available"))
+
+    @classmethod
+    def column_sepa_mandate_available(cls, tables):
+        pool = Pool()
+        Move = pool.get('account.move')
+        Mandate = pool.get('account.payment.sepa.mandate')
+        line, _ = tables[None]
+        move_tables = tables.get('move')
+        if move_tables is None:
+            move = Move.__table__()
+            tables['move'] = {
+                None: (move, move.id == line.move),
+                }
+        else:
+            move, _ = move_tables[None]
+        mandate = Mandate.__table__()
+        return Exists(mandate.select(Literal(1),
+                where=(mandate.party == line.party)
+                & (mandate.company == move.company)
+                & (mandate.state == 'validated')))
+
+
 class InvoicePaymentMean(metaclass=PoolMeta):
     __name__ = 'account.invoice.payment.mean'
 
diff -r 9a97a5df08ae -r 02b0ee5ee874 modules/account_payment_sepa/account.xml
--- a/modules/account_payment_sepa/account.xml  Wed Jul 29 18:13:09 2026 +0200
+++ b/modules/account_payment_sepa/account.xml  Mon Sep 28 12:19:07 2026 +0200
@@ -9,7 +9,7 @@
             <field name="name">Receivable with Mandate</field>
             <field name="sequence" eval="25"/>
             <field name="domain"
-                eval="['AND', ('account.type.receivable', '=', True), ['OR', 
('debit', '&gt;', 0), ('credit', '&lt;', 0)], ('party.sepa_mandates.state', 
'=', 'validated')]"
+                eval="['AND', ('account.type.receivable', '=', True), ['OR', 
('debit', '&gt;', 0), ('credit', '&lt;', 0)], ('sepa_mandate_available', '=', 
True)]"
                 pyson="1"/>
             <field name="count" eval="True"/>
             <field name="act_window" ref="account_payment.act_move_line_form"/>
diff -r 9a97a5df08ae -r 02b0ee5ee874 modules/account_payment_sepa/tryton.cfg
--- a/modules/account_payment_sepa/tryton.cfg   Wed Jul 29 18:13:09 2026 +0200
+++ b/modules/account_payment_sepa/tryton.cfg   Mon Sep 28 12:19:07 2026 +0200
@@ -28,6 +28,7 @@
     party.PartyIdentifier
     account.Configuration
     account.ConfigurationSepaMandateSequence
+    account.MoveLine
 wizard:
     party.Replace
 report:

Reply via email to