Product variant cannot appear correctly in sale order, purchase order

Bug #406016 reported by Christophe CRIER
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

If you used variants in product, they can'nt appear in 'Description' field in sale order line an in purchase order line.
To solve this y propose to modify 'product.py' file like below :

-------------------------------------------------------------------------
diff --git a/addons/product/product.py b/addons/product/product.py
index 1937912..a7cfe16 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -390,8 +390,8 @@ class product_product(osv.osv):
         product = self.browse(cr, uid, [product_id], context)[0]
         for supinfo in product.seller_ids:
             if supinfo.name.id == partner_id:
- return {'code': supinfo.product_code, 'name': supinfo.product_name}
- return {'code' : product.default_code, 'name' : product.name}
+ return {'code': supinfo.product_code, 'name': supinfo.product_name, 'variants': ''}
+ return {'code' : product.default_code, 'name' : product.name, 'variants': product.variants}

     def _product_code(self, cr, uid, ids, name, arg, context={}):
         res = {}
@@ -403,12 +403,14 @@ class product_product(osv.osv):
         res = {}
         for p in self.browse(cr, uid, ids, context):
             data = self._get_partner_code_name(cr, uid, [], p.id, context.get('partner_id', None), context)
+ if not data['code'] and not data['name']:
+ data['variants'] = p.variants
             if not data['code']:
                 data['code'] = p.code
             if not data['name']:
                 data['name'] = p.name
             res[p.id] = (data['code'] and ('['+data['code']+'] ') or '') + \
- (data['name'] or '')
+ (data['name'] or '') + (data['variants'] and (' - '+data['variants']) or '')
         return res
-------------------------------------------------------------------------

Revision history for this message
Husen Daudi (husendaudi) wrote :

Hello Christophe,
Thanks for the patch.
Applied on trunk addons as it's not a bug and improvement.
Revision info: 2311 hda@hda-20090730091713-yrh8t7gmc2rude73

Changed in openobject-addons:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.