[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: f1b2d165fb
opw:1905710
closes odoo/odoo#28585
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user