domain="[('id', 'in', duplicate_ids)]"
duplicates = self.env['hr.applicant'].with_context(active_test=False).search(domain)
Ensure the widget context does not override active_test=False
implicitly. Currently, your field looks like this<field name="selected_duplicate_id" widget="many2one" options="{'no_create': True, 'no_open': True}" context="{'active_test': False, 'hr_force_show_archived': True, 'search_default_duplicates': True}" domain="[('id', 'in', duplicate_ids)]" class="oe_inline w-100"/>
You are very close — your backend logic is correct. The final fix likely lies in ensuring the context
is properly passed into name_search()
from the form, and confirming that duplicate_ids
truly includes inactive records at runtime.
Would you like help checking your _get_similar_applicants_domain()
method too? Sometimes the filter (‘active’, ‘in’, [True, False])
might be missing there.