[FIX] account: aged receivable
- Create an invoice of 10000 at date 2016-11-30, due 2017-02-28 - Make a partial payment of 1500 at date 2016-11-09 - Make a partial payment of 1000 at date 2016-11-30 - Make a partial payment of 2000 at date 2017-01-30 At current date (e.g. 2017-04-04), run the Aged Partner Balance. 5500 is still due, but set to the +120 days period instead of 30-60. opw-725890
This commit is contained in:
parent
33076f7394
commit
3128e84243
|
@ -178,7 +178,18 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
|
|||
partners_amount = dict((i[0],0) for i in partners_partial)
|
||||
for partner_info in partners_partial:
|
||||
if partner_info[2]:
|
||||
# in case of partial reconciliation, we want to keep the left amount in the oldest period
|
||||
# in case of partial reconciliation, we want to keep the remaining amount in the
|
||||
# period corresponding to the maturity date of the invoice.
|
||||
self.cr.execute('''
|
||||
SELECT MAX(COALESCE(l.date_maturity, l.date))
|
||||
FROM account_move_line AS l
|
||||
JOIN account_account AS a ON l.account_id = a.id
|
||||
WHERE reconcile_partial_id = %s
|
||||
AND a.type IN %s
|
||||
''', (partner_info[2], tuple(self.ACCOUNT_TYPE),))
|
||||
date = self.cr.fetchall()
|
||||
# Just in case date is not defined (but it should be defined)
|
||||
if date and not date[0][0]:
|
||||
self.cr.execute('''SELECT MIN(COALESCE(date_maturity,date)) FROM account_move_line WHERE reconcile_partial_id = %s''', (partner_info[2],))
|
||||
date = self.cr.fetchall()
|
||||
partial = False
|
||||
|
|
Loading…
Reference in New Issue