From 9e2062a74bb54f27eb56c836a3058ec031eaefbf Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 10 Sep 2015 16:23:06 +0200 Subject: [PATCH] [FIX] purchase: _create_invoice_line_from_vals When creating a SO in dropshipping with 'create invoice' = 'on delivery order', the resulting invoice must not be linked to the PO but to the SO created. Inspired from '_create_invoice_line_from_vals' in addons/sale_stock/sale_stock.py opw:647628 --- addons/purchase/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 950f5b591c0..2db1be29bdc 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -76,7 +76,7 @@ class stock_move(osv.osv): invoice_line_vals['purchase_line_id'] = move.purchase_line_id.id invoice_line_vals['account_analytic_id'] = move.purchase_line_id.account_analytic_id.id or False invoice_line_id = super(stock_move, self)._create_invoice_line_from_vals(cr, uid, move, invoice_line_vals, context=context) - if move.purchase_line_id: + if context.get('inv_type') in ('in_invoice', 'in_refund') and move.purchase_line_id: purchase_line = move.purchase_line_id self.pool.get('purchase.order.line').write(cr, uid, [purchase_line.id], { 'invoice_lines': [(4, invoice_line_id)]