← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~anybox/product-extra-addons/product-extra-addons into lp:product-extra-addons

 

Simon ANDRÉ has proposed merging lp:~anybox/product-extra-addons/product-extra-addons into lp:product-extra-addons.

Requested reviews:
  Sébastien BEAU - http://www.akretion.com (sebastien.beau)

For more details, see:
https://code.launchpad.net/~anybox/product-extra-addons/product-extra-addons/+merge/121718

Just protect use of context
-- 
https://code.launchpad.net/~anybox/product-extra-addons/product-extra-addons/+merge/121718
Your team extra-addons-commiter is subscribed to branch lp:product-extra-addons.
=== modified file 'product_custom_attributes/product.py'
--- product_custom_attributes/product.py	2012-08-21 14:10:21 +0000
+++ product_custom_attributes/product.py	2012-08-28 22:42:18 +0000
@@ -94,6 +94,8 @@
         return notebook, toupdate_fields
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
+        if context==None:
+	    context={}
         result = super(product_product, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu)
         if view_type == 'form' and context.get('set_id'):
             eview = etree.fromstring(result['arch'])

=== modified file 'product_custom_attributes/product_attribute.py'
--- product_custom_attributes/product_attribute.py	2012-08-21 14:10:21 +0000
+++ product_custom_attributes/product_attribute.py	2012-08-28 22:42:18 +0000
@@ -26,6 +26,7 @@
 
 #You should install the library Unicode2Ascii, you can find it in the akretion github repository
 from unicode2ascii import Unicode2Ascii
+from tools.translate import _
 
 class attribute_option(Model):
     _name = "attribute.option"
@@ -118,10 +119,24 @@
         'attribute_set_id': fields.many2one('attribute.set', 'Attribute Set', required=True),
         'attribute_ids': fields.one2many('attribute.location', 'attribute_group_id', 'Attributes'),
         'sequence': fields.integer('Sequence'),
+<<<<<<< TREE
         }
 
 
 class attribute_set(Model):
+=======
+    }
+
+    def create(self, cr, uid, vals, context=None):
+        for attribute in vals['attribute_ids']:
+            if 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)
+
+
+class attribute_set(osv.osv):
+
+>>>>>>> MERGE-SOURCE
     _name = "attribute.set"
     _description = "Attribute Set"
     _columns = {
@@ -137,6 +152,8 @@
         return set_id
 
     def write(self, cr, uid, ids, vals, context=None):
+        if isinstance(ids, (int, long)):
+            ids = [ids]
         for set_id in ids:
             full_vals = vals.copy()
             for group in full_vals['attribute_group_ids']:


Follow ups