Localization theorem for algebraic stacks