1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
23 from report import report_sxw
25 class ir_module_reference_print(report_sxw.rml_parse):
26 def __init__(self, cr, uid, name, context):
27 super(ir_module_reference_print, self).__init__(cr, uid, name, context=context)
28 self.localcontext.update({
30 'findobj': self._object_find,
31 'objdoc': self._object_doc,
32 'objdoc2': self._object_doc2,
33 'findflds': self._fields_find,
35 def _object_doc(self, obj):
36 modobj = self.pool.get(obj)
37 strdocs= modobj.__doc__
41 strdocs=strdocs.strip().splitlines(True)
44 if not stre or stre.isspace():
49 def _object_doc2(self, obj):
50 modobj = self.pool.get(obj)
51 strdocs= modobj.__doc__
55 strdocs=strdocs.strip().splitlines(True)
60 res.append(stre.strip())
61 elif not stre or stre.isspace():
65 def _object_find(self, module):
66 ids2 = self.pool.get('ir.model.data').search(self.cr, self.uid, [('module','=',module), ('model','=','ir.model')])
68 for mod in self.pool.get('ir.model.data').browse(self.cr, self.uid, ids2):
69 ids.append(mod.res_id)
70 modobj = self.pool.get('ir.model')
71 return modobj.browse(self.cr, self.uid, ids)
73 def _fields_find(self, obj):
74 modobj = self.pool.get(obj)
75 res = modobj.fields_get(self.cr, self.uid).items()
79 report_sxw.report_sxw('report.ir.module.reference', 'ir.module.module',
80 'addons/base/module/report/ir_module_reference.rml',
81 parser=ir_module_reference_print, header=False)
84 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: