[FIX]sale_crm: when validating a SO with a sale team associated, information was...
authorCedric Snauwaert <csn@openerp.com>
Thu, 16 May 2013 15:12:55 +0000 (17:12 +0200)
committerCedric Snauwaert <csn@openerp.com>
Thu, 16 May 2013 15:12:55 +0000 (17:12 +0200)
bzr revid: csn@openerp.com-20130516151255-azu6a3x6les0tzu6

addons/sale_crm/sale_crm.py

index c6aad29..3e3c445 100644 (file)
@@ -29,6 +29,12 @@ class sale_order(osv.osv):
             domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]")
     }
 
+    def _prepare_invoice(self, cr, uid, order, lines, context=None):
+        invoice_vals = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context)
+        if order.section_id and order.section_id.id:
+            invoice_vals['section_id'] = order.section_id.id
+        return invoice_vals
+
 
 class res_users(osv.Model):
     _inherit = 'res.users'