When compute_quantities_query is called with with_childs, the selected move table is a union. So we must search inside this union for the actual move table. As we may need to join with lot table multiple times, we must ensure to always use a different instance of the table to avoid alias clash. issue7882 review48701002