[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
This commit is contained in:
Goffin Simon
2017-07-17 12:56:57 +02:00
parent 6331cd1ff5
commit fea5057425
+6
View File
@@ -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"