← Back to team overview

openerp-community team mailing list archive

lp:~arthru/openerp-product-attributes/fix-create-attribute-group into lp:openerp-product-attributes

 

arthru has proposed merging lp:~arthru/openerp-product-attributes/fix-create-attribute-group into lp:openerp-product-attributes.

Requested reviews:
  Product Core Editors (product-core-editors)
Related bugs:
  Bug #1209262 in OpenERP Product Attributes: "KeyError when creating an attribute.group with no attribute.locations"
  https://bugs.launchpad.net/openerp-product-attributes/+bug/1209262

For more details, see:
https://code.launchpad.net/~arthru/openerp-product-attributes/fix-create-attribute-group/+merge/178986

Fix bug 1209262
-- 
https://code.launchpad.net/~arthru/openerp-product-attributes/fix-create-attribute-group/+merge/178986
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-06-18 16:17:27 +0000
+++ base_custom_attributes/custom_attributes.py	2013-08-07 14:36:30 +0000
@@ -271,7 +271,7 @@
     }
 
     def create(self, cr, uid, vals, context=None):
-        for attribute in vals['attribute_ids']:
+        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)

=== modified file 'product_custom_attributes/product.py'
--- product_custom_attributes/product.py	2013-06-15 20:14:22 +0000
+++ product_custom_attributes/product.py	2013-08-07 14:36:30 +0000
@@ -36,9 +36,9 @@
             set_id = self.read(cr, uid, [i], fields=['attribute_set_id'],
                      context=context)[0]['attribute_set_id']
             if not set_id:
-                raise except_osv(_('User Error'), _('Please choose \
-                an attribute set before opening the product attributes'))
-            res[i] = self.pool.get('attribute.group').search(cr, uid,
+                res[i] = []
+            else:
+                res[i] = self.pool.get('attribute.group').search(cr, uid,
                       [('attribute_set_id', '=', set_id[0])])
         return res