openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07684
[Merge] lp:~therp-nl/ocb-web/6.1_lp1340813 into lp:ocb-web/6.1
Holger Brunn (Therp) has proposed merging lp:~therp-nl/ocb-web/6.1_lp1340813 into lp:ocb-web/6.1.
Requested reviews:
OpenERP Community Backports (ocb)
Related bugs:
Bug #1340813 in OpenERP Community Backports (Web): "[6.1][7.0] regression: Printing reports from models with incorrect/missing _rec_name causes a traceback"
https://bugs.launchpad.net/ocb-web/+bug/1340813
For more details, see:
https://code.launchpad.net/~therp-nl/ocb-web/6.1_lp1340813/+merge/226487
--
https://code.launchpad.net/~therp-nl/ocb-web/6.1_lp1340813/+merge/226487
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~therp-nl/ocb-web/6.1_lp1340813 into lp:ocb-web/6.1.
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2014-01-08 13:14:56 +0000
+++ addons/web/controllers/main.py 2014-07-11 16:27:56 +0000
@@ -1871,15 +1871,24 @@
if action_context.get('active_model') and action_context['active_ids']:
# Use built-in ORM method to get data from DB
m = req.session.model(action_context['active_model'])
- r = m.name_get(action_context['active_ids'], context)
+ r = []
+ try:
+ r = m.name_get(action_context['active_ids'], context)
+ except xmlrpclib.Fault:
+ #we assume this went wrong because of incorrect/missing
+ #_rec_name. We don't have access to _columns here to do
+ # a proper check
+ pass
# Parse result to create a better filename
item_names = [item[1] or str(item[0]) for item in r]
if action.get('name'):
item_names.insert(0, action['name'])
- file_name = '-'.join(item_names)
- # Create safe filename
- p = re.compile('[/:(")<>|?*]|(\\\)')
- file_name = p.sub('_', file_name)
+ #only change filename if we have something better
+ if item_names:
+ file_name = '-'.join(item_names)
+ # Create safe filename
+ p = re.compile('[/:(")<>|?*]|(\\\)')
+ file_name = p.sub('_', file_name)
report = base64.b64decode(report_struct['result'])
if report_struct.get('code') == 'zlib':
Follow ups