[FIX]account: process one record to set debit/credit

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) <wan@odoo.com>
This commit is contained in:
Swapnesh
2021-04-19 12:22:14 +00:00
committed by wan
parent da336947c0
commit ccba1ce694
+4 -2
View File
@@ -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