I override the "base.automation" model to make it run in seconds. When I tried creating an "automation" with python code, there was a cron job "Automation Rules: check and execute" that ran every 2 microseconds, it only stopped when it timed out and the "automation" was not executed. And I deleted the code, but the cron job loop problem "Automation Rules: check and execute" is still not resolved.Please give me a solution to set an interval trigger for automation in seconds
Github: https://github.com/longlong123-bit/external_odoo_addons/tree/main/seconds_for_cron
I have created an "automation" with python code. And as a result, my server is overloaded, because the cron job "Automation Rules: check and execute" runs non-stop.
@staticmethod
def _create_timeit_monitoring_shipment(_env, picking_id, shipment):
model_stock_picking = _env.ref('stock.model_stock_picking')
trg_date_id = _env['ir.model.fields'].search([
('name', '=', 'create_date'),
('model_id', '=', model_stock_picking.id)
])
payload = {
'name': f'[Delivery Monitoring] - {picking_id.name}',
'model_id': model_stock_picking.id,
'trigger': 'on_time_created',
'trg_date_range': 30,
'trg_date_range_type': 'seconds',
'trg_date_id': trg_date_id.id,
'filter_pre_domain': [('name', '=', picking_id.name)],
'filter_domain': [('name', '=', picking_id.name)],
'action_server_ids': [(0, 0, {
'name': 'Delivery Monitoring',
'model_id': model_stock_picking.id,
'state': 'code',
'code': f'model.delivery_auto_cancel_shipments()'
})]
}
_env['base.automation'].sudo().create(payload)