1
##############################################################################
3
# Copyright (c) 2008-2010 SIA "KN dati". (http://kndati.lv) All Rights Reserved.
4
# General contacts <info@kndati.lv>
6
# WARNING: This program as such is intended to be used by professional
7
# programmers who take the whole responsability of assessing all potential
8
# consequences resulting from its eventual inadequacies and bugs
9
# End users who are looking for a ready-to-use solution with commercial
10
# garantees and support are strongly adviced to contract a Free Software
13
# This program is Free Software; you can redistribute it and/or
14
# modify it under the terms of the GNU General Public License
15
# as published by the Free Software Foundation; either version 2
16
# of the License, or (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU General Public License for more details.
23
# You should have received a copy of the GNU General Public License
24
# along with this program; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
##############################################################################
29
from report import report_sxw
30
from report.report_sxw import rml_parse
32
class Parser(report_sxw.rml_parse):
33
def __init__(self, cr, uid, name, context):
34
super(Parser, self).__init__(cr, uid, name, context)
35
self.localcontext.update({
36
'get_contract': self.get_contract,
37
'get_department': self.get_department,
40
def get_department(self, data=None):
41
''' Get department list with wizard parameter
43
# TODO interface with wizard (for department Id or all)
49
dept=data.get('department_id', False)
51
filter_dept=[('id','=',dept)]
53
dept_pool = self.pool.get('hr.department')
54
dept_ids = dept_pool.search(self.cr, self.uid, filter_dept, order='name')
55
return dept_pool.browse(self.cr, self.uid, dept_ids)
57
def get_contract(self, department_id, data=None):
58
''' Get list of contract with passed department
64
domain=[('department_id','=',department_id)]
65
contract_id = data.get('contract_id', False)
67
domain.append(('id','=',contract_id))
69
contract_pool = self.pool.get('account.analytic.account')
70
contract_ids = contract_pool.search(self.cr, self.uid, domain, order='code,name')
71
return contract_pool.browse(self.cr, self.uid, contract_ids)