summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2018-11-12 14:09:09 +0000
committerGoffin Simon <sig@odoo.com>2018-11-13 10:36:58 +0000
commitb879dca025e1f1d14e0dfd558c47cc82f2576cf1 (patch)
tree2d8189cfcd03105c2595f148950684a8d2757fa8 /addons
parent58e4db64337e05590259e8759e31356383a9cae0 (diff)
[FIX] sale: Payment terms from SO
Let's consider a customer C with payment terms P1 set on it Steps to reproduce the bug: - Create a SO for C with payment terms P2 - Confirm the SO and generate the invoice Bug: The payment terms on the invoice was P1 instead of P2 This fix allows to keep the same behavior as in 11.0 Introduced by: f1b2d165fb5378a8f6140b42d19f1e028cc289cc opw:1905710 closes odoo/odoo#28585
Diffstat (limited to 'addons')
-rw-r--r--addons/sale/models/sale.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index ca1b2cecdb1..6afc0b6b5d3 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -563,7 +563,10 @@ class SaleOrder(models.Model):
# by onchanges, which are not triggered when doing a create.
invoice.compute_taxes()
# Idem for partner
+ so_payment_term_id = invoice.payment_term_id.id
invoice._onchange_partner_id()
+ # 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',
values={'self': invoice, 'origin': references[invoice]},
subtype_id=self.env.ref('mail.mt_note').id)