changeset 21c174473c58 in modules/account_payment_sepa:5.0
details:
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset&node=21c174473c58
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 dc1b65008782 -r 21c174473c58 payment.py
--- a/payment.py Thu Jun 17 21:48:23 2021 +0200
+++ b/payment.py Sun Oct 03 13:48:43 2021 +0200
@@ -405,7 +405,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):
@@ -550,10 +550,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)
@@ -564,7 +564,7 @@
group_by=payment.sepa_mandate))
has_payments.update(cursor.fetchall())
- return {'has_payments': has_payments}
+ return has_payments
@classmethod
@ModelView.button
diff -r dc1b65008782 -r 21c174473c58 tests/test_account_payment_sepa.py
--- a/tests/test_account_payment_sepa.py Thu Jun 17 21:48:23 2021 +0200
+++ b/tests/test_account_payment_sepa.py Sun Oct 03 13:48:43 2021 +0200
@@ -341,6 +341,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')
@@ -363,6 +364,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,