From fea5057425ede4d92d0c74717cb9d9d6cc708fae Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 13 Jul 2017 13:50:38 +0200 Subject: [PATCH] [FIX] account: Unlinking payment term When unlinking payment terms, the ir.property records linked to the fields "property_payment_term_id" and "property_supplier_payment_term_id" were not deleted. opw:749459 --- addons/account/models/account_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 0e1c1b30dab..122d04a45ec 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1397,6 +1397,12 @@ class AccountPaymentTerm(models.Model): result.append((last_date, dist)) return result + @api.multi + def unlink(self): + property_recs = self.env['ir.property'].search([('value_reference', 'in', ['account.payment.term,%s'%payment_term.id for payment_term in self])]) + property_recs.unlink() + return super(AccountPaymentTerm, self).unlink() + class AccountPaymentTermLine(models.Model): _name = "account.payment.term.line"