Test SEPA mandate sequence of the company of the mandate instead of the context

Closes #13882
(grafted from fd065f036503c116574e45bccd836b240d248a02)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2025-02-19 23:37:00 +01:00
1 parent 5644bf9718
commit 424b01299b
1 file changed
+5 -4
+5 -4
View File
@@ -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