← Back to team overview

avanzosc team mailing list archive

[Merge] lp:~avanzosc/openobject-addons/extra-6.0 into lp:openobject-addons/extra-6.0

 

Ainara has proposed merging lp:~avanzosc/openobject-addons/extra-6.0 into lp:openobject-addons/extra-6.0.

Requested reviews:
  OpenERP Committers (openerp-commiter)

For more details, see:
https://code.launchpad.net/~avanzosc/openobject-addons/extra-6.0/+merge/147060

nan_product_pack modified to fix bug number 1098640
Duplicating a sale order which already pack with its components corrupt original sale order
-- 
https://code.launchpad.net/~avanzosc/openobject-addons/extra-6.0/+merge/147060
Your team Avanzosc Developers is subscribed to branch lp:~avanzosc/openobject-addons/extra-6.0.
=== modified file 'nan_product_pack/pack.py'
--- nan_product_pack/pack.py	2012-05-15 15:38:52 +0000
+++ nan_product_pack/pack.py	2013-02-07 10:33:22 +0000
@@ -128,6 +128,11 @@
         'pack_depth': lambda *a: 0,
         'compute_margin': lambda *a: True,
     }
+    
+    def create(self, cr, uid, vals={}, context={}):
+        if not (context.has_key('expand') and context['expand']):
+            vals.update({'pack_parent_line_id':False, 'pack_child_line_ids':[(6,0,[])]})
+        return super(sale_order_line, self).create(cr,uid,vals,context)
 sale_order_line()
 
 class sale_order(osv.osv):
@@ -252,7 +257,7 @@
                         'move_ids': [(6,0,[])],
                         'discount': discount,
                         'number_packages': False,
-                        'notes': False,
+                        'notes': subproduct.description_sale,
                         'th_weight': False,
                         'state': 'draft',
                         'pack_parent_line_id': line.id,
@@ -267,7 +272,7 @@
                     # It's a control for the case that the nan_external_prices was installed with the product pack
                     if 'prices_used' in line:
                         vals[ 'prices_used' ] = line.prices_used
-
+                    context.update({'expand':True})
                     self.pool.get('sale.order.line').create(cr, uid, vals, context)
                     if not order.id in updated_orders:
                         updated_orders.append( order.id )