Yes, you can do this. But there's no reason to cobble it together yourself; the Huber company (no affiliation) manufactures something called Zip-R that's an all-in-one version of what you're describing, plus a weather-resistant outer face that can be taped and doesn't need an additional water-resistive barrier (like Tyvek or tar paper) over it. Other companies make something called "nailbase" that's basically the same thing, but without the weather-resistant outer face. However, other aspects of your plan are more problematic:
Red flag #1: you talked about using spray foam between the studs up against foam board. That could be dangerous. Two-part spray foam heats up substantially as it cures, and polystyrene-based rigid foam boards (i.e. EPS and XPS) have a low melting temperature; about 170f, and they can liquify or ignite at higher temperatures. Don't spray foam against existing polystyrene foam board or you could start a fire. Additionally, depending on the blowing agent of the spray foam, you may destroy the foam boards; polystyrene is melted away by many common aerosols. Finally, it's a huge waste of expensive spray foam due to the thermal bridging of the studs. With the thermal break of foam board outside the studs, you're better off using cellulose, mineral wool, or high-density fiberglass between the studs and saving your money for something else.
Red flag #2: you mention a vapor barrier. Most walls south of Canada don't need or want vapor barriers. They can benefit from vapor retarders on the inside, and the paint on the drywall is generally sufficient. The water-restive barrier that goes outside the OSB or plywood sheathing (usually Tyvek or tar paper) is not a vapor barrier, it's a water barrier.
Red flag #3: you imply that you want to attach siding over the OSB surface because all the foam will constitute a vapor barrier. You are confusing vapor barriers with water-resistive barriers, which serve different purposes. All wooden exterior walls need a water-resistive barrier outside of any wooden surface and underneath the siding. Even if you followed your plan and spray-foamed between the studs against other foam board and didn't set the house on fire or destroy the foam board, you would still need a water-resistive barrier such as Tyvek or tar paper over the OSB to have a code-legal house that won't become a mold-and-rot machine. There's a reason they sometimes call OSB "vertical mulch!" Keep it completely dry all the time.