From 5d2828504e166cef5afe38f28e1ff88420113a0d Mon Sep 17 00:00:00 2001 From: pinky <> Date: Wed, 27 Dec 2006 15:20:33 +0000 Subject: [PATCH] SALE: Factures d'accompte bzr revid: pinky-c7df7758d1727915511fe4372b71696ff117b801 --- addons/sale/sale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 4deec00eb6e..d5ca8e3ef0d 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -129,7 +129,7 @@ class sale_order(osv.osv): 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft':[('readonly',False)]}), 'payment_line': fields.one2many('sale.order.payment', 'order_id', 'Order Payments', readonly=True, states={'draft':[('readonly',False)]}), - 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', readonly=True, help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), + 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), 'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this invoice"), 'shipped':fields.boolean('Picked', readonly=True), @@ -204,6 +204,11 @@ class sale_order(osv.osv): pay_term = order.partner_id.property_payment_term[0] else: pay_term = False + for preinv in order.invoice_ids: + if preinv.state in ('open','paid','proforma'): + for preline in preinv.invoice_line: + inv_line_id = self.pool.get('account.invoice.line').copy(cr, uid, preline.id, {'invoice_id':False, 'price_unit':-preline.price_unit}) + lines.append(inv_line_id) inv = { 'name': order.name, 'origin': order.name,