From 8636a2b77183e8d3694be908a771b9841ea81ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 12 Dec 2024 13:41:51 +0100 Subject: [PATCH] Add payment reference in record name of payment --- modules/account_payment/payment.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/account_payment/payment.py b/modules/account_payment/payment.py index 54c63a7167..b20287a7b8 100644 --- a/modules/account_payment/payment.py +++ b/modules/account_payment/payment.py @@ -567,6 +567,24 @@ class Payment(Workflow, ModelSQL, ModelView): field_name = 'process_method' return Journal.fields_get([field_name])[field_name]['selection'] + def get_rec_name(self, name): + items = [self.number] + if self.reference: + items.append(f'[{self.reference}]') + return ' '.join(items) + + @classmethod + def search_rec_name(cls, name, clause): + _, operator, value = clause + if operator.startswith('!') or operator.startswith('not '): + bool_op = 'AND' + else: + bool_op = 'OR' + return [bool_op, + ('number', *clause[1:]), + ('reference', *clause[1:]), + ] + @classmethod def view_attributes(cls): context = Transaction().context