When displaying attachment download in tree, it contains garbage: (%<-size%>)

Bug #1196969 reported by Ronald Portier (Therp)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

I want to display for a portal kind of application a download link to an attachment in a tree. No further info on the attachment should be shown to the user.

This is my field definition in the view:

<field
name="attachment_ids"
colspan="3"
nolabel="1"
mode="tree"
readonly="1">
<tree
    editable="top"
    string="Attachments">
    <field
        name="type"
        invisible="1" />
    <field
        name="datas_fname"
        invisible="1" />
    <field
        name="datas"
        readonly="1"
        filename="datas_fname"/>
</tree>
</field>

When displaying attachment download in tree, it contains garbage: (%<-size%>)

The (%<-size%>) is apparantly a placeholder to put the size of the file.

The code that actualyly creates this text is in addons/web/static/src/js/formats.js:

324 case "binary":
325 var text = _t("Download"),
326 download_url = _.str.sprintf('/web/binary/saveas?session_id=%s&model=%s&field=%s&id=%d', openerp.connection.ses sion_id, options.model, column.id, options.id);
327 if (column.filename) {
328 download_url += '&filename_field=' + column.filename;
329 if (row_data[column.filename]) {
330 text = _.str.sprintf(_t("Download \"%s\""), openerp.web.format_value(
331 row_data[column.filename].value, {type: 'char'}));
332 }
333 }
334 return _.template('<a href="<%-href%>"><%-text%></a> (%<-size%>)', {
335 text: text,
336 href: download_url,
337 size: row_data[column.id].value
338 });

No idea how the size of the file is supposed to come from row_data[column.id].value, but iit is definitely not working.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :
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.