From 0984153cb17707f3cff061b03ce5e8fc98280c24 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Wed, 11 Feb 2015 22:13:32 +0100 Subject: [PATCH] [IMP] Use api.one to avoid a loop --- account_cash_discount_base/models/account_invoice.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/account_cash_discount_base/models/account_invoice.py b/account_cash_discount_base/models/account_invoice.py index 0c34c84c9ed..cb6423a7ff2 100644 --- a/account_cash_discount_base/models/account_invoice.py +++ b/account_cash_discount_base/models/account_invoice.py @@ -63,7 +63,7 @@ def compute_discount_amount(self): self.discount_percent != 0.0): self.discount_amount = self._compute_discount_amount() - @api.v8 + @api.one def compute_discount_due_date(self): if self.discount_delay != 0 and (self.type != 'in_invoice' or self.discount_delay != 0): @@ -90,6 +90,5 @@ def action_move_create(self): @api.multi def action_date_assign(self): super(account_invoice, self).action_date_assign() - for inv in self: - inv.compute_discount_due_date() + self.compute_discount_due_date() return True