From 3418f8c4c47fea91eb5280a67f3c9f0f96f58753 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 14 May 2019 14:06:05 +0000 Subject: [PATCH] [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: 9bf1f97d9bfa2128f36a103fbb8aa671a91b5417 Closes #32309 opw:1830838 closes odoo/odoo#33383 Signed-off-by: Simon Goffin (sig) --- addons/sale/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/account_invoice.py b/addons/sale/models/account_invoice.py index 0a2406a0968..c705c793c93 100644 --- a/addons/sale/models/account_invoice.py +++ b/addons/sale/models/account_invoice.py @@ -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):