diff --git a/modules/account_payment_sepa/payment.py b/modules/account_payment_sepa/payment.py index 3b43408a6c..c5fa9b4a5d 100644 --- a/modules/account_payment_sepa/payment.py +++ b/modules/account_payment_sepa/payment.py @@ -596,11 +596,12 @@ class Mandate(Workflow, ModelSQL, ModelView): vlist = [v.copy() for v in vlist] default_company = cls.default_company() for values in vlist: - if (config.sepa_mandate_sequence - and not values.get('identification')): - values['identification'] = config.get_multivalue( + if not values.get('identification'): + sequence = config.get_multivalue( 'sepa_mandate_sequence', - company=values.get('company', default_company)).get() + company=values.get('company', default_company)) + if sequence: + values['identification'] = sequence.get() # Prevent raising false unique constraint if values.get('identification') == '': values['identification'] = None