[FIX] sale: Keep fiscal position from SO

Steps to reproduce the bug:
- Create two fiscal postions fp1 and fp2
- Create a customer C with fp1
- Create a SO for C and set fp2
- Create an invoice for the SO

BUG:

The fiscal position of the SO was set to False.
Now the fiscal position of the SO is kept when creating an invoice
from a SO.

opw:1963910

closes odoo/odoo#32713

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-04-17 07:16:25 +00:00
parent 7bf25cc333
commit c2f15d3f1a
+2
View File
@@ -587,7 +587,9 @@ class SaleOrder(models.Model):
invoice.compute_taxes()
# Idem for partner
so_payment_term_id = invoice.payment_term_id.id
fp_invoice = invoice.fiscal_position_id
invoice._onchange_partner_id()
invoice.fiscal_position_id = fp_invoice
# To keep the payment terms set on the SO
invoice.payment_term_id = so_payment_term_id
invoice.message_post_with_view('mail.message_origin_link',