'automated actions through xml files

I managed to make the system send a message as a notification when some expiration date is close

BUT

I created a server action and an automatic action both in the GUI

I'd like to use xml files to create such actions

Otherwise I have to remember to create them every time I create a new db

I found something but for Odoo 15, I'm on Odoo 14



Solution 1:[1]

The creation of server actions and automated actions from XML are same in Odoo 14.0 or 15.0 and you can check the Odoo 14.0 Documentation

Example for server action:

<record id="act_hr_employee_holiday_request" model="ir.actions.server">
    <field name="name">Time off Analysis</field>
    <field name="model_id" ref="hr_holidays.model_hr_leave_report"/>
    <field name="binding_model_id" ref="hr.model_hr_employee"/>
    <field name="state">code</field>
    <field name="groups_id" eval="[(4, ref('base.group_user'))]"/>
    <field name="code">
    action = model.action_time_off_analysis()
    </field>
</record>

Examples for automated action.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1