Merge lp:~therp-nl/ocb-web/7.0_lp1340813 into lp:ocb-web

Proposed by Holger Brunn (Therp)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~therp-nl/ocb-web/7.0_lp1340813
Merge into: lp:ocb-web
Diff against target: 26 lines (+10/-2)
1 file modified
addons/web/controllers/main.py (+10/-2)
To merge this branch: bzr merge lp:~therp-nl/ocb-web/7.0_lp1340813
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Yann Papouin code review Approve
Review via email: mp+226488@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I think that the name would have an initial dot if there is no _recname, leading to incorrect file names or hidden files. Can it be?

I suggest to put:

if file_name:
    file_name = '%s.%s' % (file_name, report_struct['format'])
else:
    file_name = report_struct['format']

Regards.

review: Needs Information (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

No, the diff only shows the code that runs if there's enough information in the context to try to do something better. file_name is initialized with the report's name, so if the item_names test fails, you end up with the record's name (ie account.something.report)

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

[...] the report's name [...]

Revision history for this message
Yann Papouin (yann-papouin) wrote :

Ok

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the answer.

Regards.

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

One more thing. This MP should be converted to PR in the new OCB project on GitHub.

Regards.

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

https://github.com/OCA/OCB/pull/18

Thanks, I'm still confused which is the leading branch with the different projects

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

git, so I'm rejecting this one.

Unmerged revisions

4204. By Holger Brunn (Therp)

[FIX] calling name_get can cause tracebacks when printing reports
[IMP] only change name if we found a better one

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-05-19 12:41:22 +0000
3+++ addons/web/controllers/main.py 2014-07-11 16:34:22 +0000
4@@ -1759,12 +1759,20 @@
5 and action_context['active_ids']):
6 # Use built-in ORM method to get data from DB
7 m = req.session.model(action_context['active_model'])
8- r = m.name_get(action_context['active_ids'], context)
9+ r = []
10+ try:
11+ r = m.name_get(action_context['active_ids'], context)
12+ except xmlrpclib.Fault:
13+ #we assume this went wrong because of incorrect/missing
14+ #_rec_name. We don't have access to _columns here to do
15+ # a proper check
16+ pass
17 # Parse result to create a better filename
18 item_names = [item[1] or str(item[0]) for item in r]
19 if action.get('name'):
20 item_names.insert(0, action['name'])
21- file_name = '-'.join(item_names)
22+ if item_names:
23+ file_name = '-'.join(item_names)
24 file_name = '%s.%s' % (file_name, report_struct['format'])
25 # Create safe filename
26 p = re.compile('[/:(")<>|?*]|(\\\)')

Subscribers

People subscribed via source and target branches