~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to msf_budget/analytic.py

  • Committer: jf
  • Date: 2012-04-17 15:29:16 UTC
  • mfrom: (631.3.7 UF_828)
  • Revision ID: jf@tempo4-20120417152916-svm6ioq8ur2bi5tu
UF-955 [DEV] Reporting (Month-end) - 2 remaining reports
lp:~unifield-team/unifield-wm/UF_955

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
#-*- encoding:utf-8 -*-
3
 
##############################################################################
4
 
#
5
 
#    OpenERP, Open Source Management Solution
6
 
#    Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved
7
 
#    Developer: Olivier DOSSMANN
8
 
#
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.
13
 
#
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.
18
 
#
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/>.
21
 
#
22
 
##############################################################################
23
 
 
24
 
from osv import osv
25
 
from tools.translate import _
26
 
 
27
 
class account_analytic_line(osv.osv):
28
 
    _name = 'account.analytic.line'
29
 
    _inherit = 'account.analytic.line'
30
 
 
31
 
    def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
32
 
        summary_obj = self.pool.get('msf.budget.summary')
33
 
        if context is None:
34
 
            context = {}
35
 
        if 'search_budget' in context and context['search_budget']:
36
 
            if 'summary_id' in context and context['summary_id']:
37
 
                domain = summary_obj._get_analytic_domain(cr, uid, context['summary_id'], context=context)
38
 
                if domain:
39
 
                    args += domain
40
 
                else:
41
 
                    # Line without domain (consumption, overhead)
42
 
                    raise osv.except_osv(_('No Analytic Domain !'),_("This budget does not have an analytic domain!"))
43
 
 
44
 
        return super(account_analytic_line, self).search(cr, uid, args, offset, limit, order, context=context, count=count)
45
 
account_analytic_line()
46
 
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: