From 35cd85b0ba98a54697221456ad204c1f1ec5c62d Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 22 May 2013 12:48:58 +0200 Subject: [PATCH] [FIX] sale: overwrite _make_invoice and get section_id in sale_crm module bzr revid: chm@openerp.com-20130522104858-zlhe453zu9r41lqx --- addons/sale/sale.py | 4 ---- addons/sale_crm/sale_crm.py | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 8d23d5da022..577199ddaee 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -400,10 +400,6 @@ class sale_order(osv.osv): def _make_invoice(self, cr, uid, order, lines, context=None): inv_obj = self.pool.get('account.invoice') obj_invoice_line = self.pool.get('account.invoice.line') - if context is None: - context = {} - if order.section_id: - context.update({'default_section_id': order.section_id.id}) invoiced_sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('order_id', '=', order.id), ('invoiced', '=', True)], context=context) from_line_invoice_ids = [] for invoiced_sale_line_id in self.pool.get('sale.order.line').browse(cr, uid, invoiced_sale_line_ids, context=context): diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index 0576bf6d731..28b0387c2c0 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -39,6 +39,11 @@ class sale_order(osv.osv): domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]") } + def _make_invoice(self, cr, uid, order, lines, context=None): + if order.section_id: + context = dict(context or {}, default_section_id= order.section_id.id) + return super(sale_order, self)._make_invoice(cr, uid, order, lines, context=context) + class crm_case_section(osv.osv): _inherit = 'crm.case.section'