diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 021381f3461..26f99fc2f96 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -436,7 +436,7 @@ class sale_order(osv.osv): 'currency_id': order.pricelist_id.currency_id.id, 'comment': order.note, 'payment_term': pay_term, - 'fiscal_position': order.partner_id.property_account_position.id, + 'fiscal_position': order.partner_id.property_account_position.id or order.fiscal_position.id, 'date_invoice' : context.get('date_invoice',False), 'company_id' : order.company_id.id, } diff --git a/addons/sale/stock.py b/addons/sale/stock.py index e2f632bf711..f86dcfdd58e 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -139,6 +139,10 @@ class stock_picking(osv.osv): sale_lines = picking.sale_id.order_line invoice_created = invoices[result[picking.id]] + for inv in invoice_obj.browse(cursor, user, [invoice_created.id], context=context): + if not inv.fiscal_position: + invoice_obj.write(cursor, user, [inv.id], {'fiscal_position': picking.sale_id.fiscal_position.id}, context=context) + if picking.sale_id.client_order_ref: inv_name = picking.sale_id.client_order_ref + " : " + invoice_created.name invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context) diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py index 4bf3074db54..bb22000f8e1 100644 --- a/addons/sale/wizard/sale_line_invoice.py +++ b/addons/sale/wizard/sale_line_invoice.py @@ -82,7 +82,7 @@ class sale_order_line_make_invoice(osv.osv_memory): 'currency_id' : order.pricelist_id.currency_id.id, 'comment': order.note, 'payment_term': pay_term, - 'fiscal_position': order.partner_id.property_account_position.id + 'fiscal_position': order.partner_id.property_account_position.id or order.fiscal_position.id } inv_id = self.pool.get('account.invoice').create(cr, uid, inv) return inv_id diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 6c9ca17b836..a78f548617b 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -95,7 +95,7 @@ class sale_advance_payment_inv(osv.osv_memory): 'currency_id' :sale.pricelist_id.currency_id.id, 'comment': '', 'payment_term':sale.payment_term.id, - 'fiscal_position': sale.partner_id.property_account_position.id + 'fiscal_position': sale.partner_id.property_account_position.id or sale.fiscal_position.id } inv_id = inv_obj.create(cr, uid, inv)