From 9fe33e650e771a41bfb908ef991736e62036d8fb Mon Sep 17 00:00:00 2001 From: Swapnesh Shah Date: Wed, 9 Oct 2019 19:07:31 +0000 Subject: [PATCH] [FIX] account: Use correct field in domain Fixes https://github.com/odoo/odoo/issues/38308 payment_term_id has been replaced by invoice_payment_term_id closes odoo/odoo#38448 X-original-commit: f6a5510e677404d6f917049b732b8fe5ba98a78b Signed-off-by: Laurent Smet --- addons/account/models/account_payment_term.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_payment_term.py b/addons/account/models/account_payment_term.py index bd202de2d5f..bb918807168 100644 --- a/addons/account/models/account_payment_term.py +++ b/addons/account/models/account_payment_term.py @@ -69,7 +69,7 @@ class AccountPaymentTerm(models.Model): def unlink(self): for terms in self: - if self.env['account.move'].search([('payment_term_id', 'in', terms.ids)]): + if self.env['account.move'].search([('invoice_payment_term_id', 'in', terms.ids)]): raise UserError(_('You can not delete payment terms as other records still reference it. However, you can archive it.')) property_recs = self.env['ir.property'].search([('value_reference', 'in', ['account.payment.term,%s'%payment_term.id for payment_term in terms])]) property_recs.unlink()