openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #04107
lp:~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023 into lp:openerp-product-attributes
Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023 into lp:openerp-product-attributes.
Commit message:
[FIX] prevent KeyError if no 'attribute_ids' is present in 'vals'
Requested reviews:
Product Core Editors (product-core-editors)
Related bugs:
Bug #1256023 in OpenERP Product Attributes: "base_custom_attributes: create() on attribute.group raises KeyError"
https://bugs.launchpad.net/openerp-product-attributes/+bug/1256023
For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023/+merge/197092
Fixes lp:1256023
--
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-attribute-set-create-1256023/+merge/197092
Your team OpenERP Community is subscribed to branch lp:openerp-product-attributes.
=== modified file 'base_custom_attributes/custom_attributes.py'
--- base_custom_attributes/custom_attributes.py 2013-11-13 08:38:19 +0000
+++ base_custom_attributes/custom_attributes.py 2013-11-28 15:34:56 +0000
@@ -352,9 +352,9 @@
}
def create(self, cr, uid, vals, context=None):
- for attribute in vals['attribute_ids']:
- if vals.get('attribute_set_id') and attribute[2] and \
- not attribute[2].get('attribute_set_id'):
+ for attribute in vals.get('attribute_ids', []):
+ if (vals.get('attribute_set_id') and attribute[2] and
+ not attribute[2].get('attribute_set_id')):
attribute[2]['attribute_set_id'] = vals['attribute_set_id']
return super(attribute_group, self).create(cr, uid, vals, context)
Follow ups