From 752186173fed4c2a3b71f4e504a0e8336cfb12a9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Jan 2012 17:23:43 +0100 Subject: [PATCH] If the fiscal position has been changed on the sale order, the invoice should use the fiscal posion of the sale order and not the fiscal position of the partner. bzr revid: alexis@via.ecp.fr-20120105162343-tf8359d8hrk7r2j1 --- addons/sale/stock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 618867821fb..30b9367cf4c 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -71,6 +71,12 @@ class stock_picking(osv.osv): return picking.note or picking.sale_id.note return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) + def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): + invoice_vals = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context) + if picking.sale_id and picking.sale_id.fiscal_position: + invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id + return invoice_vals + def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id: uom_id = move_line.product_id.uom_id.id