19 lines
591 B
Python
19 lines
591 B
Python
import re
|
|
|
|
with open('addons/education_lms/security/security.xml', 'r') as f:
|
|
text = f.read()
|
|
|
|
# Replace all occurrences of user.student_ids.field.ids with user.student_ids.mapped('field').ids
|
|
# Specifically for program_id, academic_year_id, academic_term_id, batch_id
|
|
|
|
fields = ['program_id', 'academic_year_id', 'academic_term_id', 'batch_id']
|
|
for field in fields:
|
|
text = re.sub(
|
|
rf'user\.student_ids\.{field}\.ids',
|
|
f"user.student_ids.mapped('{field}').ids",
|
|
text
|
|
)
|
|
|
|
with open('addons/education_lms/security/security.xml', 'w') as f:
|
|
f.write(text)
|