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
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2014-01-23 17:08:36 +0000
+++ addons/web/controllers/main.py 2014-01-28 14:14:34 +0000
@@ -1305,6 +1305,9 @@
1305 fields.append(filename_field)1305 fields.append(filename_field)
1306 if data:1306 if data:
1307 res = { field: data }1307 res = { field: data }
1308 if id and filename_field:
1309 file_name = Model.read([int(id)], [filename_field], context)[0][filename_field]
1310 res.update({ filename_field: file_name })
1308 elif id:1311 elif id:
1309 res = Model.read([int(id)], fields, context)[0]1312 res = Model.read([int(id)], fields, context)[0]
1310 else:1313 else:
13111314
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js 2014-01-15 11:00:38 +0000
+++ addons/web/static/src/js/view_list.js 2014-01-28 14:14:34 +0000
@@ -2241,7 +2241,7 @@
2241 var text = _t("Download");2241 var text = _t("Download");
2242 var value = row_data[this.id].value;2242 var value = row_data[this.id].value;
2243 var download_url;2243 var download_url;
2244 if (value && value.substr(0, 10).indexOf(' ') == -1) {2244 if (value && value.substr(0, 10).indexOf(' ') == -1 && instance.web.BufferedDataSet.virtual_id_regex.test(options.id)) {
2245 download_url = "data:application/octet-stream;base64," + value;2245 download_url = "data:application/octet-stream;base64," + value;
2246 } else {2246 } else {
2247 download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});2247 download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});