You can achieve this in Odoo 18 by setting up an Automated Action to assign your newly created default accounts when a new contact is created. Follow these steps:
Click Create and set the following parameters:
- Action Name: Default Accounts on Contacts
- Model: Contacts (res.partner)
- Active: ✅ (Check this)
- Trigger: On Creation
- Apply On: Match all records
- Action To Do: Python Code
record['property_account_payable_id'] = env['account.account'].search([('code', '=', '510000')], limit=1).id
record['property_account_receivable_id'] = env['account.account'].search([('code', '=', '420000')], limit=1).id