Merge lp:~stefan-opener/therp-backports/addons61-lp939588-check_partner_category_id_is_not_list into lp:therp-backports/server-6.1

Proposed by Stefan Rijnhart (Opener) on 2013-03-31
Status: Merged
Merged at revision: 4302
Proposed branch: lp:~stefan-opener/therp-backports/addons61-lp939588-check_partner_category_id_is_not_list
Merge into: lp:therp-backports/server-6.1
Diff against target: 13 lines (+2/-1)
1 file modified
openerp/addons/base/res/res_partner.py (+2/-1)
To merge this branch: bzr merge lp:~stefan-opener/therp-backports/addons61-lp939588-check_partner_category_id_is_not_list
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) 2013-03-31 Approve on 2013-04-10
Review via email: mp+156296@code.launchpad.net
To post a comment you must log in.
Holger Brunn (Therp) (hbrunn) wrote :

if you have a context like
{'category_id': [(6, 0, 42)]}
as you mention in your bug report, the condition you add evaluates to False.

Shouldn't it be
not context.get('category_id') or not isinstance(context['category_id'], (int, long))
?

review: Needs Fixing
4301. By Stefan Rijnhart (Opener) on 2013-04-09

[FIX] Logical error found in review by Holger
[FIX] Mismatched parenthesis

Thanks for saving me there! Fixed it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/res/res_partner.py'
2--- openerp/addons/base/res/res_partner.py 2012-04-10 14:41:38 +0000
3+++ openerp/addons/base/res/res_partner.py 2013-04-09 12:57:19 +0000
4@@ -279,7 +279,8 @@
5 def view_header_get(self, cr, uid, view_id, view_type, context):
6 res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context)
7 if res: return res
8- if (not context.get('category_id', False)):
9+ if (not context.get('category_id') or not
10+ isinstance(context['category_id'], (int, long))):
11 return False
12 return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
13 def main_partner(self, cr, uid):

Subscribers

People subscribed via source and target branches