The separate delivery and collection services of goods through different routes is an issue of current interest for some transportation companies by the need to avoid the reorganization of the loads inside the vehicles, to reduce the return of the vehicles with empty load and to give greater priority to the delivery customers. In the vehicle routing problem with backhauls (VRPB), the customers are partitioned into two subsets: linehaul (delivery) and backhaul (pickup) customers. Additionally, a precedence constraint is established: the backhaul customers in a route should be visited after all the linehaul customers. The VRPB is presented in the literature as an extension of the capacitated vehicle routing problem and is NP-hard in the strong sense. In this paper, we propose a mixed integer linear programming formulation for the VRPB, based on the generalization of the open vehicle routing problem; that eliminates the possibility of generating solutions formed by subtours using a set of new constraints focused on obtaining valid solutions formed by Hamiltonian paths and connected by tie-arcs. The proposed formulation is a general purpose model in the sense that it does not deserve specifically tailored algorithmic approaches for their effective solution. The computational results show that the proposed compact formulation is competitive against state-of-the-art exact methods for VRPB instances from the literature.