PURPOSE Visitors are useful in terms of marketing analysis but they can bloat the database really quickly if you have a lot of traffic on your website. This commit aims to relieve the database by fully deleting inactive visitors. SPECS On an active website, you can easily reach hundreds or even thousands of visitors per day. While active visitors are useful for marketing purposes, inactive ones were archived after a period of inactivity (i.e: not connected for X days in a row, where X is configurable as a parameter and 30 by default). But archiving visitors is not really useful either. We don't see any specific cases where you would want to restore some visitors. That means we are better off unlinking the visitors completely to save database storage space. We want to make exceptions and avoid deletion of inactive visitors in some cases: - When they are linked to a partner (meaning most likely linked to a registered user) - When they are linked to leads - When they are registered to events Several tests were added to ensure that leads matching these conditions are not unlinked. We also took this opportunity to enforce the "_link_to_visitor" rules in those tests to make sure that: - When visitors are linked, the leads are merged into the main visitor - When visitors are linked, the event tickets are merged into the main visitor - When visitors are linked, the wishlisted tracks are merged into the main visitor This is also preliminary work for a commit that will move the push_token of website.visitors to a separate table. That will in turn allow us to link the push_tokens within the "_link_to_visitor" method and delete the linked visitor instead of archiving it. LINKS Task-2410217 Part-of: odoo/odoo#65113
15 lines
598 B
XML
15 lines
598 B
XML
<?xml version="1.0" encoding='UTF-8'?>
|
|
<odoo>
|
|
<record id="website_visitor_cron" model="ir.cron">
|
|
<field name="name">Website Visitor : clean inactive visitors</field>
|
|
<field name="model_id" ref="model_website_visitor"/>
|
|
<field name="state">code</field>
|
|
<field name="code">model._cron_unlink_old_visitors()</field>
|
|
<field name="interval_number">1</field>
|
|
<field name="interval_type">days</field>
|
|
<field name="numbercall">-1</field>
|
|
<field name="active" eval="True"/>
|
|
<field name="doall" eval="False"/>
|
|
</record>
|
|
</odoo>
|