changeset e2385ef1d1c7 in modules/account_payment_sepa:5.8 details: https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset&node=e2385ef1d1c7 description: Rename getter of has_payments to avoid name collision
issue10810 review339021002 (grafted from 99a864afc2b93a87550b32f4bcd4a45796b91f93) diffstat: payment.py | 8 ++++---- tests/test_account_payment_sepa.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diffs (53 lines): diff -r 29ea041d21d3 -r e2385ef1d1c7 payment.py --- a/payment.py Fri Jan 01 16:21:18 2021 +0100 +++ b/payment.py Sun Oct 03 13:48:43 2021 +0200 @@ -476,7 +476,7 @@ ], 'State', readonly=True) payments = fields.One2Many('account.payment', 'sepa_mandate', 'Payments') has_payments = fields.Function(fields.Boolean('Has Payments'), - 'has_payments') + 'get_has_payments') @classmethod def __setup__(cls): @@ -638,10 +638,10 @@ return 'RCUR' @classmethod - def has_payments(cls, mandates, name): + def get_has_payments(cls, mandates, name): pool = Pool() Payment = pool.get('account.payment') - payment = Payment.__table__ + payment = Payment.__table__() cursor = Transaction().connection.cursor() has_payments = dict.fromkeys([m.id for m in mandates], False) @@ -652,7 +652,7 @@ group_by=payment.sepa_mandate)) has_payments.update(cursor.fetchall()) - return {'has_payments': has_payments} + return has_payments @classmethod @ModelView.button diff -r 29ea041d21d3 -r e2385ef1d1c7 tests/test_account_payment_sepa.py --- a/tests/test_account_payment_sepa.py Fri Jan 01 16:21:18 2021 +0100 +++ b/tests/test_account_payment_sepa.py Sun Oct 03 13:48:43 2021 +0200 @@ -295,6 +295,7 @@ journal = setup_journal('pain.008.001.02', 'receivable', company, company_account) + self.assertFalse(mandate.has_payments) self.assertEqual(mandate.sequence_type, 'FRST') mandate.sequence_type_rcur = True self.assertEqual(mandate.sequence_type, 'RCUR') @@ -318,6 +319,7 @@ _, data = process_payment.do_process(None) self.assertEqual(payment.sepa_mandate_sequence_type, 'FRST') + self.assertTrue(payment.sepa_mandate.has_payments) payments = Payment.create([{ 'company': company,