Merge lp:~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023 into lp:~product-core-editors/openerp-product-attributes/7.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 225
Proposed branch: lp:~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023
Merge into: lp:~product-core-editors/openerp-product-attributes/7.0
Diff against target: 15 lines (+3/-3)
1 file modified
base_custom_attributes/custom_attributes.py (+3/-3)
To merge this branch: bzr merge lp:~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com (code review, no test) Approve
Alex Comba - Agile BG (community) code review, no test Approve
Pedro Manuel Baeza code review, no test Approve
Review via email: mp+197092@code.launchpad.net

Commit message

[FIX] prevent KeyError if no 'attribute_ids' is present in 'vals'

Description of the change

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Alex Comba - Agile BG (tafaru) :
review: Approve (code review, no test)
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

LGTM

review: Approve ((code review, no test))

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_custom_attributes/custom_attributes.py'
2--- base_custom_attributes/custom_attributes.py 2013-11-13 08:38:19 +0000
3+++ base_custom_attributes/custom_attributes.py 2013-11-28 15:34:56 +0000
4@@ -352,9 +352,9 @@
5 }
6
7 def create(self, cr, uid, vals, context=None):
8- for attribute in vals['attribute_ids']:
9- if vals.get('attribute_set_id') and attribute[2] and \
10- not attribute[2].get('attribute_set_id'):
11+ for attribute in vals.get('attribute_ids', []):
12+ if (vals.get('attribute_set_id') and attribute[2] and
13+ not attribute[2].get('attribute_set_id')):
14 attribute[2]['attribute_set_id'] = vals['attribute_set_id']
15 return super(attribute_group, self).create(cr, uid, vals, context)
16

Subscribers

People subscribed via source and target branches