Rifakat (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/7.0-opw-584983-rha into lp:openerp-web/7.0.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/7.0-opw-584983-rha/+merge/145573
Hello,
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.
Regards,
Rifakat Haradwala
--
https://code.launchpad.net/~openerp-dev/openerp-web/7.0-opw-584983-rha/+merge/145573
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/7.0-opw-584983-rha.
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2013-01-29 14:26:38 +0000
+++ addons/web/controllers/main.py 2013-01-30 10:40:27 +0000
@@ -1250,15 +1250,17 @@
context = jdata.get('context', {})
Model = req.session.model(model)
- fields = [field]
+ fields = []
+ if not data:
+ fields.append(field)
if filename_field:
fields.append(filename_field)
if data:
res = { field: data }
- elif id:
- res = Model.read([int(id)], fields, context)[0]
+ if id:
+ res.update(Model.read([int(id)], fields, context)[0])
else:
- res = Model.default_get(fields, context)
+ res.update(Model.default_get(fields, context))
filecontent = base64.b64decode(res.get(field, ''))
if not filecontent:
raise ValueError(_("No content found for field '%s' on '%s:%s'") %
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp