From 965024902db880af005a9688a277b28e076a4a7e Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 6 Jul 2016 10:32:06 +0200 Subject: [PATCH] [FIX] delivery: Invoice line for delivery method Steps to reproduce: 1. Activate the following options ** Settings > Warehouse > Products > Manage different units of measure for products ** Settings > Accounting > Accounting & Finance > Analytic accouting 2. Desactivate the following option ** Settings > Accounting > Analytic accouting > Sale > Use multiple analytic accounts on sales 3. Create a Sale order ** Add 2 qty of the product iMac ** Add in quote the delivery method "Normal Delivery Charges" and set 2 qty ** Set an analytic account under Contract/Analytic ** Set the field Create Invoice to "On delivery Order" 4. Deliver only 1 quantity of the iMac and then create the invoice 5. Deliver the last quantity of the iMac and then create the invoice Behavior before the fix: The first invoice contains 2 qty of the Transport The second invoice contains 1 qty of the Transport, has no analytic account set, has no UOM set Behavior after the fix: The first invoice contains 2 qty of the Transport The second invoice contains 0 qty of the Transport because it has already been invoiced Closed #12644 opw:682284 --- addons/delivery/stock.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index cb713e7f1d0..a1ac3649a66 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -79,6 +79,10 @@ class stock_picking(osv.osv): :return: dict containing the values to create the invoice line, or None to create nothing """ + if picking.sale_id: + delivery_line = picking.sale_id.order_line.filtered(lambda l: l.is_delivery and l.invoiced) + if delivery_line: + return None carrier_obj = self.pool.get('delivery.carrier') grid_obj = self.pool.get('delivery.grid') currency_obj = self.pool.get('res.currency')