'Generates maintenance request on the next_action_date or today if none exists'

@api.model
def _cron_generate_requests(self):

    for equipment in self.search([('period', '>', 0)]):
        next_requests = self.env['maintenance.request'].search([('stage_id.done', '=', False), ('equipment_id', '=', equipment.id), ('maintenance_type', '=', 'preventive'), ('request_date', '=', equipment.next_action_date)])
        if (not next_requests):
            equipment._create_new_request(equipment.next_action_date)
