Merge lp:~openerp-dev/openerp-web/7.0-opw-603411-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-603411-msh
Merge into: lp:openerp-web/7.0
Diff against target: 26 lines (+4/-1)
2 files modified
addons/web/controllers/main.py (+3/-0)
addons/web/static/src/js/view_list.js (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-603411-msh
Reviewer Review Type Date Requested Status
Xavier (Open ERP) Pending
Naresh(OpenERP) Pending
Fabien Meghazi (OpenERP) Pending
Review via email: mp+203553@code.launchpad.net

Description of the change

Hello,

Fixed the issue with file not downloaded when it is inside one2many or many2many with widget=one2many_list in listview.

Demo: Add many2many field with relation to ir.attachment in any test object, design the test object view in which many2many field will have inline tree view with widget="one2many_list", something like:
<record id="view_test_test_form_view" model="ir.ui.view">
    <fields ..../>
    <field name="linkeddocument_ids" nolabel="1" widget="one2many_list">
        <field name="datas_fname" invisible="1"/>
        <field name="name"/>
        <field name="datas" filename="datas_fname"/>
    </field>

Now add a record with one attachment in that model's record and save the whole record, you will be having download link in record of one2many_list widget, when you click on that file is not downloaded propoerly with proper name, improved the fix of bug #1077858, this fix causing the issue.

Thanks.

To post a comment you must log in.

Unmerged revisions

4128. By Mohammed Shekha(OpenERP)<email address hidden>

[FIX]Fixed the issue with file not downloaded when it is inside one2many or many2many with widget=one2many_list in listview.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/controllers/main.py'
2--- addons/web/controllers/main.py 2014-01-23 17:08:36 +0000
3+++ addons/web/controllers/main.py 2014-01-28 14:14:34 +0000
4@@ -1305,6 +1305,9 @@
5 fields.append(filename_field)
6 if data:
7 res = { field: data }
8+ if id and filename_field:
9+ file_name = Model.read([int(id)], [filename_field], context)[0][filename_field]
10+ res.update({ filename_field: file_name })
11 elif id:
12 res = Model.read([int(id)], fields, context)[0]
13 else:
14
15=== modified file 'addons/web/static/src/js/view_list.js'
16--- addons/web/static/src/js/view_list.js 2014-01-15 11:00:38 +0000
17+++ addons/web/static/src/js/view_list.js 2014-01-28 14:14:34 +0000
18@@ -2241,7 +2241,7 @@
19 var text = _t("Download");
20 var value = row_data[this.id].value;
21 var download_url;
22- if (value && value.substr(0, 10).indexOf(' ') == -1) {
23+ if (value && value.substr(0, 10).indexOf(' ') == -1 && instance.web.BufferedDataSet.virtual_id_regex.test(options.id)) {
24 download_url = "data:application/octet-stream;base64," + value;
25 } else {
26 download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});