[FIX] account: compute debit credit based on previous year to have consistent result all the time, courtesy of Nhomar (vauxoo)

bzr revid: mat@openerp.com-20131022091925-mqj2etd71guplhm7
This commit is contained in:
Martin Trigaux 2013-10-22 11:19:25 +02:00
commit cba3a4114e
1 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,9 @@ class res_partner(osv.osv):
_description = 'Partner'
def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
ctx = context.copy()
ctx['all_fiscalyear'] = True
query = self.pool.get('account.move.line')._query_get(cr, uid, context=ctx)
cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
FROM account_move_line l
LEFT JOIN account_account a ON (l.account_id=a.id)