From 61a5bbfb210859e3c795d8c7d25c941f6091b4dd Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 8 May 2015 11:18:44 +0200 Subject: [PATCH] [FIX] stock_account: add taxes to invoice when creating an invoice from delivery Generating an invoice from a delivery now add the taxes to the invoice. This impacts a returned purchase for which the invoice is created from the delivery, and a sale order which is set to create invoice on delivery. opw-634565 --- addons/stock_account/stock.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index b59d7144250..d7dcdd5443f 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -151,6 +151,13 @@ class stock_move(osv.osv): if move.product_uos: uos_id = move.product_uos.id quantity = move.product_uos_qty + + taxes_ids = [] + if move.origin_returned_move_id.purchase_line_id.taxes_id: + taxes_ids = [tax.id for tax in move.origin_returned_move_id.purchase_line_id.taxes_id] + elif move.procurement_id.sale_line_id.tax_id: + taxes_ids = [tax.id for tax in move.procurement_id.sale_line_id.tax_id] + return { 'name': move.name, 'account_id': account_id, @@ -158,6 +165,7 @@ class stock_move(osv.osv): 'uos_id': uos_id, 'quantity': quantity, 'price_unit': self._get_price_unit_invoice(cr, uid, move, inv_type), + 'invoice_line_tax_id': [(6, 0, taxes_ids)], 'discount': 0.0, 'account_analytic_id': False, }