Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Invoicing
Entity: account.account
Compute Method: _compute_opening_debit_credit
| Inputs | Method | Outputs |
|---|---|---|
|
- self.opening_debit = 0 - self.opening_credit = 0 - self.opening_balance = 0 opening_move = self.env.company.account_opening_move_id if not self.ids or not opening_move: return self.env.cr.execute(SQL( """ SELECT line.account_id, SUM(line.balance) AS balance, SUM(line.debit) AS debit, SUM(line.credit) AS credit FROM account_move_line line WHERE line.move_id = %(opening_move_id)s AND line.account_id IN %(account_ids)s GROUP BY line.account_id """, account_ids=tuple(self.ids), opening_move_id=opening_move.id, )) result = {r['account_id']: r for r in self.env.cr.dictfetchall()} for record in self: res = result.get(record.id) or {'debit': 0, 'credit': 0, 'balance': 0} - record.opening_debit = res['debit'] - record.opening_credit = res['credit'] - record.opening_balance = res['balance'] + record.opening_debit = record.opening_debit or res['debit'] + record.opening_credit = record.opening_credit or res['credit'] + record.opening_balance = record.opening_balance or res['balance'] |
|
