changeset 21ba112d0513 in modules/account_payment_sepa:6.0
details:
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset&node=21ba112d0513
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 6ba30812b116 -r 21ba112d0513 payment.py
--- a/payment.py Thu Sep 16 23:50:29 2021 +0200
+++ b/payment.py Sun Oct 03 13:48:43 2021 +0200
@@ -482,7 +482,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):
@@ -650,10 +650,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)
@@ -664,7 +664,7 @@
group_by=payment.sepa_mandate))
has_payments.update(cursor)
- return {'has_payments': has_payments}
+ return has_payments
@classmethod
@ModelView.button
diff -r 6ba30812b116 -r 21ba112d0513 tests/test_account_payment_sepa.py
--- a/tests/test_account_payment_sepa.py Thu Sep 16 23:50:29 2021 +0200
+++ b/tests/test_account_payment_sepa.py Sun Oct 03 13:48:43 2021 +0200
@@ -299,6 +299,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')
@@ -322,6 +323,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,