Merge lp:~openerp-dev/openerp-web/7.0-opw-584983-rha into lp:openerp-web/7.0

Proposed by Rifakat Husen (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-584983-rha
Merge into: lp:openerp-web/7.0
Diff against target: 25 lines (+6/-4)
1 file modified
addons/web/controllers/ (+6/-4)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-584983-rha
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email:

Description of the change


Problem: When try downloading any file from wizard that put file name as the model's name.

Currently when binary field has default value then read() or default_get() are never getting called,
and hence we will not have filename according to filename attrs given in xml.

When save_as_ajax requested from view_form.js at that time value of filename field will not be available, we have to read it.

Code change, when data available then only reads filename attribute otherwise read data as well as filename.

Thanks for your review and feedback.

Rifakat Haradwala

To post a comment you must log in.

Unmerged revisions

3732. By Rifakat Husen (OpenERP)

[FIX] for wizard, name of the file to download from binary field should not be wizard model name,
if binary field has filename='name' and default value is already set for name then file to download with this name,

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/controllers/'
2--- addons/web/controllers/ 2013-01-29 14:26:38 +0000
3+++ addons/web/controllers/ 2013-01-30 10:40:27 +0000
4@@ -1250,15 +1250,17 @@
5 context = jdata.get('context', {})
7 Model = req.session.model(model)
8- fields = [field]
9+ fields = []
10+ if not data:
11+ fields.append(field)
12 if filename_field:
13 fields.append(filename_field)
14 if data:
15 res = { field: data }
16- elif id:
17- res =[int(id)], fields, context)[0]
18+ if id:
19+ res.update([int(id)], fields, context)[0])
20 else:
21- res = Model.default_get(fields, context)
22+ res.update(Model.default_get(fields, context))
23 filecontent = base64.b64decode(res.get(field, ''))
24 if not filecontent:
25 raise ValueError(_("No content found for field '%s' on '%s:%s'") %