[FIX] calendar: avoid memory overflow
[FIX] calendar: avoid memory overflow

On a DB with thousands of events including recurring ones, fetching the
complete list of events might lead to a memory overflow due to the
prefetching of all virtual events.

We reduce the memory footprint by handling no more than 50,000 records
at a time and clearing the cache at each step. This limit is purely
arbitrary, but seems to be a good compromise between performance and
memory usage.

opw-1832482

ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo