id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 10060,Multiple table annotation failure,svsharma@…,,"Annotating across multiple tables results in wrong answers. i.e. {{{ In [110]: total = Branch.objects.all().annotate(total=Sum('center__client__loan__amount')) In [111]: total[0].total Out[111]: 3433000 In [112]: repaid = Branch.objects.all().annotate(repaid=Sum('center__client__loan__payment_schedule__payments__principal')) In [113]: repaid[0].repaid Out[113]: 1976320.0 In [114]: both = Branch.objects.all().annotate(total=Sum('center__client__loan__amount'),repaid=Sum('center__client__loan__payment_schedule__payments__principal')) In [115]: both[0].repaid Out[115]: 1976320.0 In [116]: both[0].total Out[116]: 98816000 ^^^^^^^^^^^ }}} Compare the output of total in 116 vs. 111 (the correct answer).",Bug,new,"Database layer (models, ORM)",dev,Normal,,,flosch@… bendavis78@… cmutel@… daniel@… Gabriel Hurley sebleier@… greg@… mpjung@… teemu.kurppa@… Evstifeev Roman michaelB Marc Aymerich nowak2000@… Maxim Gökhan Sarı Adam M. Costello Antoine David Kwong,Accepted,0,0,0,0,0,0