[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 <smetl@users.noreply.github.com>
This commit is contained in:
Swapnesh Shah
2019-10-11 03:12:05 +00:00
committed by fw-bot
parent bf5744b5c3
commit 9fe33e650e
@@ -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()