import re with open('addons/education_lms/tests/test_education_lms.py', 'r') as f: text = f.read() text = text.replace( " res = course_a.with_user(self.user_student_a).read(['name'])", """ # Debug Domain rule = self.env['ir.rule'].sudo().search([('name', '=', 'Student Course Access')], limit=1) domain = rule._compute_domain(rule.model_id.model, 'read') print(f"\\nDEBUG DOMAIN GENERATED FOR STUDENT A: {domain}") res = course_a.with_user(self.user_student_a).read(['name'])""" ) with open('addons/education_lms/tests/test_education_lms.py', 'w') as f: f.write(text)