From 43cf6d51d2b4ccd98dc02c1221bf4b51871f92fe Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 17 Dec 2014 13:57:34 +0100 Subject: [PATCH] [FIX] account: aged partner balance, advance partial payment Partners totals were not correct if the partner paid partially an invoice in advance For an invoice of 20.000 in the future, with a payment made in advance of 5000 The column not due must contains 20.000, as the amount is not yet due One of the column 1-30, 30-60, ... (accordingly on when the payment was made). must contains -5000 The total should be 15.000 --- addons/account/report/account_aged_partner_balance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index b2887bc0de2..57498f8a66d 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -188,9 +188,12 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): partial = date and date[0][0] <= form[str(i)]['stop'] if partial: # partial reconcilation + limit_date = 'COALESCE(l.date_maturity,l.date) %s %%s' % '<=' if self.direction_selection == 'past' else '>=' self.cr.execute('''SELECT SUM(l.debit-l.credit) FROM account_move_line AS l, account_move AS am - WHERE l.move_id = am.id AND am.state in %s AND l.reconcile_partial_id = %s''', (tuple(move_state), partner_info[2],)) + WHERE l.move_id = am.id AND am.state in %s + AND l.reconcile_partial_id = %s + AND ''' + limit_date, (tuple(move_state), partner_info[2], self.date_from)) unreconciled_amount = self.cr.fetchall() partners_amount[partner_info[0]] += unreconciled_amount[0][0] else: