38
38
if isinstance(ids, (int, long)):
40
42
# Only process first id
41
43
account = self.pool.get('account.analytic.account').browse(cr, uid, ids, context=context)[0]
42
44
if account.category != 'FUNDING':
47
49
search.append(('date', '>=', account.date_start))
49
51
search.append(('date', '<=', account.date))
50
# Search default MSF Private Fund analytic account
52
fp_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'analytic_distribution', 'analytic_account_msf_private_funds')[1]
55
if account.id != fp_id:
56
if account.tuple_destination_account_ids:
57
search.append(('is_fp_compat_with', '=', account.id))
59
# trick to avoid problem with FP that have NO destination link. So we need to search a "False" Destination.
60
search.append(('destination_id', '=', 0))
61
if account.cost_center_ids:
62
search.append(('cost_center_id', 'in', [x.id for x in account.cost_center_ids]))
64
# trick to avoid problem with FP that have NO CC.
65
search.append(('cost_center_id', '=', 0))
52
if account.tuple_destination_account_ids:
53
search.append(('is_fp_compat_with', '=', account.id))
55
# trick to avoid problem with FP that have NO destination link. So we need to search a "False" Destination.
56
search.append(('destination_id', '=', 0))
57
if account.cost_center_ids:
58
search.append(('cost_center_id', 'in', [x.id for x in account.cost_center_ids]))
60
# trick to avoid problem with FP that have NO CC.
61
search.append(('cost_center_id', '=', 0))
66
62
for criterium in [('account_id', '!=', account.id), ('journal_id.type', '!=', 'engagement'), ('is_reallocated', '=', False), ('is_reversal', '=', False)]:
67
63
search.append(criterium)
68
64
search.append(('contract_open','=', True))