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
This commit is contained in:
Alexis de Lattre
2012-01-05 17:23:43 +01:00
parent 638ca9122e
commit 752186173f
+6
View 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