If the fiscal position has been changed on the sale order, the invoice should use...
authorAlexis de Lattre <alexis@via.ecp.fr>
Thu, 5 Jan 2012 16:23:43 +0000 (17:23 +0100)
committerAlexis de Lattre <alexis@via.ecp.fr>
Thu, 5 Jan 2012 16:23:43 +0000 (17:23 +0100)
bzr revid: alexis@via.ecp.fr-20120105162343-tf8359d8hrk7r2j1

addons/sale/stock.py

index 6188678..30b9367 100644 (file)
@@ -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