[7.0]attachment_use tag for report always evaluate as True even when set to False

Bug #1192644 reported by Houssine
34
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Undecided
OpenERP Publisher's Warranty Team

Bug Description

attachment_use tag for report always evaluated as True even when set to False

to reproduce try to set in any report the attachment_use tag to False it will be always evaluated as True.

the main reason come from the following code in the function _tag_report of the convert.py file in the tool folder

looking at the code the attachment_use is avaluated as a string type while it should be evaluated like the "multi" tag

def _tag_report(self, cr, rec, data_node=None):
        res = {}
        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'), ('usage','usage')):
            if rec.get(field):
                res[dest] = rec.get(field).encode('utf8')
        if rec.get('auto'):
            res['auto'] = eval(rec.get('auto','False'))
        if rec.get('sxw'):
            sxw_content = misc.file_open(rec.get('sxw')).read()
            res['report_sxw_content'] = sxw_content
        if rec.get('header'):
            res['header'] = eval(rec.get('header','False'))
        if rec.get('report_type'):
            res['report_type'] = rec.get('report_type')

        res['multi'] = rec.get('multi') and eval(rec.get('multi','False'))

        xml_id = rec.get('id','').encode('utf8')
        self._test_xml_id(xml_id)

this code should be replaced by the following to make it evaluates the tag correctly

    def _tag_report(self, cr, rec, data_node=None):
        res = {}
        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'),('usage','usage')):
            if rec.get(field):
                res[dest] = rec.get(field).encode('utf8')
        if rec.get('auto'):
            res['auto'] = eval(rec.get('auto','False'))
        if rec.get('sxw'):
            sxw_content = misc.file_open(rec.get('sxw')).read()
            res['report_sxw_content'] = sxw_content
        if rec.get('header'):
            res['header'] = eval(rec.get('header','False'))
        if rec.get('report_type'):
            res['report_type'] = rec.get('report_type')

        res['multi'] = rec.get('multi') and eval(rec.get('multi','False'))
        res['attachment_use'] = rec.get('attachment_use') and eval(rec.get('attachment_use','False'))

        xml_id = rec.get('id','').encode('utf8')
        self._test_xml_id(xml_id)

Tags: maintenance
description: updated
description: updated
Changed in openobject-server:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
Houssine (houssine-bakkali) wrote :

Hi Guys,

Could we have some progress to see this merged in 7.0

Thanks

summary: - attachment_use tag for report always evaluate as True even when set to
- False
+ [7.0]attachment_use tag for report always evaluate as True even when set
+ to False
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Houssine,

I'm removing OCB-addons as an affected project for this bug as per project policy. Of course the bug affects ocb-addons/7.0, but we only want to track bugs that we fix in OCB-specific changes. Therefore, you should only add bugs to the project that you are going to propose a solution for.

Thanks,
Stefan.

no longer affects: ocb-addons
no longer affects: ocb-addons/7.0
Revision history for this message
Leonardo Donelli (learts92) wrote :

Guys, this bug is pretty serious. A lot of people waste a lot of time in development because the cached file is served and not regenerated.
Any news?

Changed in openobject-server:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.