[IMP] rng,convert: add support for report `usage` attribute

The `usage` attribute may indicate a special purpose
of this report. For instance, the "default" usage
is used to identify the report to include along with
a record for EDI exports.

bzr revid: odo@openerp.com-20111010142226-ceradf4acsbr3r5l
This commit is contained in:
Olivier Dony 2011-10-10 16:22:26 +02:00
parent 9857cb60fa
commit 0c9e9a7643
2 changed files with 6 additions and 1 deletions

View File

@ -114,6 +114,10 @@
<rng:optional> <rng:attribute name="attachment" /> </rng:optional>
<rng:optional> <rng:attribute name="attachment_use" /> </rng:optional>
<rng:optional> <rng:attribute name="groups"/> </rng:optional>
<!-- `Usage` may help identify the best report for a certain task,
for example usage="default" for reports that are attached by
default in EDI exports -->
<rng:optional><rng:attribute name="usage"/></rng:optional>
<rng:empty />
</rng:element>
</rng:define>

View File

@ -314,7 +314,8 @@ form: module.record_id""" % (xml_id,)
for dest,f in (('name','string'),('model','model'),('report_name','name')):
res[dest] = rec.get(f,'').encode('utf8')
assert res[dest], "Attribute %s of report is empty !" % (f,)
for field,dest in (('rml','report_rml'),('file','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')):
for field,dest in (('rml','report_rml'),('file','report_rml'),('xml','report_xml'),('xsl','report_xsl'),
('attachment','attachment'),('attachment_use','attachment_use'), ('usage','usage')):
if rec.get(field):
res[dest] = rec.get(field).encode('utf8')
if rec.get('auto'):