From e574d232efacddf6e7ecc4cfeb01365e115648cc Mon Sep 17 00:00:00 2001 From: EL HADJI DEM Date: Wed, 8 Oct 2014 12:17:32 -0400 Subject: [PATCH] [UPD] Change definition 0f recurrent_sequence_type and type fields in account_banking_sepa_direct_debit module --- .../account_banking_sdd.py | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/account_banking_sepa_direct_debit/account_banking_sdd.py b/account_banking_sepa_direct_debit/account_banking_sdd.py index ef17f29ae..f3fe88caf 100644 --- a/account_banking_sepa_direct_debit/account_banking_sdd.py +++ b/account_banking_sepa_direct_debit/account_banking_sdd.py @@ -118,18 +118,32 @@ class sdd_mandate(orm.Model): } } + def _get_type(self, cr, uid, context=None): + return [ + ('recurrent', _('Recurrent')), + ('oneoff', _('One-Off')), + ] + + def _get_recurrent_sequence_type(self, cr, uid, context=None): + return [ + ('first', _('First')), + ('recurring', _('Recurring')), + ('final', _('Final')), + ] + _columns = { - 'type': fields.selection([ - ('recurrent', 'Recurrent'), - ('oneoff', 'One-Off'), - ], 'Type of Mandate', required=True, track_visibility='always'), - 'recurrent_sequence_type': fields.selection([ - ('first', 'First'), - ('recurring', 'Recurring'), - ('final', 'Final'), - ], 'Sequence Type for Next Debit', track_visibility='onchange', + 'type': fields.selection( + lambda self, *a, **kw: self._get_type(*a, **kw), + string='Type of Mandate', + required=True, track_visibility='always' + ), + 'recurrent_sequence_type': fields.selection( + lambda self, *a, **kw: self._get_recurrent_sequence_type(*a, **kw), + string='Sequence Type for Next Debit', + track_visibility='onchange', help="This field is only used for Recurrent mandates, not for " - "One-Off mandates."), + "One-Off mandates." + ), 'sepa_migrated': fields.boolean( 'Migrated to SEPA', track_visibility='onchange', help="If this field is not active, the mandate section of the "