2
#-*- encoding:utf-8 -*-
3
##############################################################################
5
# OpenERP, Open Source Management Solution
6
# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved
7
# Developer: Olivier DOSSMANN
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU Affero General Public License as
11
# published by the Free Software Foundation, either version 3 of the
12
# License, or (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU Affero General Public License for more details.
19
# You should have received a copy of the GNU Affero General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
##############################################################################
26
class account_analytic_line(osv.osv):
27
_name = 'account.analytic.line'
28
_inherit = 'account.analytic.line'
30
def search(self, cr, uid, args, offset=0, limit=None, order=None, context={}, count=False):
31
donor_line_obj = self.pool.get('financing.contract.donor.reporting.line')
34
if 'search_financing_contract' in context and context['search_financing_contract']:
35
if 'active_id' in context and \
36
'reporting_type' in context:
37
donor_line = donor_line_obj.browse(cr, uid, context['active_id'], context=context)
39
if donor_line.computation_type not in ('children_sum', 'analytic_sum'):
40
raise osv.except_osv(_('Warning !'), _("The line selected has no analytic lines associated."))
44
date_domain = eval(donor_line.date_domain)
45
args += [date_domain[0],
47
donor_line_obj._get_account_domain(donor_line)]
48
if context['reporting_type'] == 'allocated':
50
args += [eval(donor_line.funding_pool_domain)]
53
private_funds_id = self.pool.get('account.analytic.account').search(cr, uid, [('code', '=', 'PF')], context=context)
55
args += [('account_id', '!=', private_funds_id),
56
eval(donor_line.cost_center_domain)]
58
return super(account_analytic_line, self).search(cr, uid, args, offset, limit, order, context=context, count=count)
60
account_analytic_line()
61
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: