From f847701c5a8779a24795b584fdcebf1aba2a543f Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 9 Nov 2015 14:29:54 +0100 Subject: [PATCH] [FIX] website_sale: attribute conflict with m2m tags color The color field of a product.attribute.value enable users to choose a color with its HTML color value (hexa, named, rgb, rgba). In the many2many tags the color field on the model has a magic feature which color the tag in several instances. But these color are numbered from 0 to 10 and are incompatible with HTML color values. So with with the model product.attribute.value, the many2many tags widget would use the color system (since a field name color exists), and when setting a color with it, it would be invalid and erase the wanted named or HTML value color. This fix ignore the setting of the tag color for this particular model, a following fix (in master) should rename the column to properly fix this. opw-653124 --- addons/website_sale/models/product.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index da1bcb93f38..e88a02c61fd 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -190,3 +190,10 @@ class product_attribute_value(osv.Model): _columns = { 'color': fields.char("HTML Color Index", help="Here you can set a specific HTML color index (e.g. #ff0000) to display the color on the website if the attibute type is 'Color'."), } + + # TODO in master: remove this function and change 'color' field name + def write(self, cr, uid, ids, vals, context=None): + # ignore write coming from many2many_tags color system + if vals.keys() == ['color'] and isinstance(vals['color'], (int, long)): + vals = {} + return super(product_attribute_value, self).write(cr, uid, ids, vals, context=context)