Hi,
The error happens because date-based filters like "Next 4 days" involve dynamic expressions, which automated actions (server actions/studio rules) in Odoo do not always support reliably, especially when combined with "On Create and Edit" triggers.
Instead of triggering "On Create/Edit", the correct and stable way is to use a Scheduled Action (Cron job) that runs daily and checks if any leads are older than 4 days and have not been updated.
Try the following steps.
1- Go to Settings > Technical > Automation > Scheduled Actions
Create a new one:
          Model: crm.lead
          Name: "Check inactive leads > 4 days"
        Active: True
        Interval Number: 1
         Interval Unit: Days
         Next Execution Date: Today
         Action To Do: Execute Python Code
2. Use this Python Code:
 from datetime import datetime, timedelta
four_days_ago = datetime.now() - timedelta(days=4)
leads = model.search([
    ('stage_id.name', '=', 'XXX'),  # Replace XXX with your stage name
    ('write_date', '<', four_days_ago),
])
for lead in leads:
    lead.activity_schedule(
        'mail.mail_activity_data_todo',
        summary="Follow up with lead",
        note="This lead hasn't been updated in over 4 days.",
        user_id=lead.user_id.id or False,
    )
- If you're using Odoo Studio, try using a workaround with an invisible computed field:
       * Add a new boolean field like lead_stale.
       * Compute it via a scheduled action or automated server action (using Python).
       * Use this field to trigger activities, avoiding literal date comparison in domains.
Hope it helps