[FIX] account_budget: support view and consolidation children in budget positions

In account_budget module,
when creating a budget position,
the user can select view accounts and also accounts with consolidation children,
in addition to normal accounts.

However, when viewing budgets with positions containing only view accounts,
the "practical amount" field was always zero.

Since these type of accounts are accepted as budget positions,
the system should take into account children and consolidation children
when computing the practical amount.

Fixes #372
Closes #1247
This commit is contained in:
Stéphane Bidoul 2014-07-17 17:29:32 +02:00 committed by Denis Ledoux
parent 1511e788cf
commit da9d1a8c45
1 changed files with 2 additions and 0 deletions

View File

@ -114,10 +114,12 @@ class crossovered_budget_lines(osv.osv):
result = 0.0
if context is None:
context = {}
account_obj = self.pool.get('account.account')
for line in self.browse(cr, uid, ids, context=context):
acc_ids = [x.id for x in line.general_budget_id.account_ids]
if not acc_ids:
raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % ustr(line.general_budget_id.name))
acc_ids = account_obj._get_children_and_consol(cr, uid, acc_ids, context=context)
date_to = line.date_to
date_from = line.date_from
if line.analytic_account_id.id: