Module technical guide: allow extended documentation.

bzr revid: p_christ@hol.gr-20090504221758-26sqirpis8h3sm3y
This commit is contained in:
P. Christeas
2009-05-05 01:17:58 +03:00
parent b7fe61abe9
commit 465a2cb3c9
2 changed files with 34 additions and 1 deletions
@@ -233,6 +233,12 @@
<para style="terp_tblheader_Details">Object: [[ object.model ]] [[ objdoc(object.model) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">[[ repeatIn(objdoc2(object.model), 'sline') ]]</para>
<para style="terp_default_9"> [[ sline ]] </para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">
@@ -30,11 +30,38 @@ class ir_module_reference_print(report_sxw.rml_parse):
'time': time,
'findobj': self._object_find,
'objdoc': self._object_doc,
'objdoc2': self._object_doc2,
'findflds': self._fields_find,
})
def _object_doc(self, obj):
modobj = self.pool.get(obj)
return modobj.__doc__
strdocs= modobj.__doc__
if not strdocs:
return None
else:
strdocs=strdocs.strip().splitlines(True)
res = ''
for stre in strdocs:
if not stre or stre.isspace():
break
res += stre
return res
def _object_doc2(self, obj):
modobj = self.pool.get(obj)
strdocs= modobj.__doc__
if not strdocs:
return None
else:
strdocs=strdocs.strip().splitlines(True)
res = []
fou = False
for stre in strdocs:
if fou:
res.append(stre.strip())
elif not stre or stre.isspace():
fou = True
return res
def _object_find(self, module):
ids2 = self.pool.get('ir.model.data').search(self.cr, self.uid, [('module','=',module), ('model','=','ir.model')])