From ccba1ce6940cdfc5ee45a62d8497624bfbab4dd4 Mon Sep 17 00:00:00 2001 From: Swapnesh Date: Tue, 13 Apr 2021 17:54:29 +0000 Subject: [PATCH] [FIX]account: process one record to set debit/credit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, There would be Expected singleton error on changing Credit/Debit for multile account in single call. Now, We are proocess one record to set `_set_opening_debit_credit` closes odoo/odoo#69474 X-original-commit: 8fe9f552ed4591795b449f4d1e32e1563ce43ca2 Signed-off-by: William André (wan) --- addons/account/models/account_account.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index e722472bbe5..a6f7dcbe785 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -284,10 +284,12 @@ class AccountAccount(models.Model): account.is_off_balance = account.internal_group == "off_balance" def _set_opening_debit(self): - self._set_opening_debit_credit(self.opening_debit, 'debit') + for record in self: + record._set_opening_debit_credit(record.opening_debit, 'debit') def _set_opening_credit(self): - self._set_opening_debit_credit(self.opening_credit, 'credit') + for record in self: + record._set_opening_debit_credit(record.opening_credit, 'credit') def _set_opening_debit_credit(self, amount, field): """ Generic function called by both opening_debit and opening_credit's