[FIX] sale: T&C issue when changing partner

Steps to reproduce:
1. Create an invoice with a customer and enter some text in Terms and Conditions (field: comment).
2. Save the invoice.
3. Edit the invoice and change the customer.

Bug:
The text in Terms and Conditions was empty.

Same behavior as on the SO, if the company doesn't change the T&C should be kept.

Fine tuning of this commit: 9bf1f97d9b
Closes #32309

opw:1830838

closes odoo/odoo#33383

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-05-22 09:10:30 +00:00
parent 95f8eb410e
commit 3418f8c4c4
+1 -1
View File
@@ -41,7 +41,7 @@ class AccountInvoice(models.Model):
self.partner_shipping_id = addr and addr.get('delivery')
if self.env.context.get('type', 'out_invoice') == 'out_invoice':
company = self.company_id or self.env.user.company_id
self.comment = company.with_context(lang=self.partner_id.lang).sale_note
self.comment = company.with_context(lang=self.partner_id.lang).sale_note or (self._origin.company_id == company and self.comment)
@api.multi
def action_invoice_paid(self):