parameters: (self, domain=None, date=None)
return_statement: return total_balance, nb_lines
docstring: Get the outstanding payments balance of the current journal by filtering the journal items using the
          journal's accounts.
  
          :param domain:  An additional domain to be applied on the account.move.line model.
          :param date:    The date to be used when performing the currency conversions.
          :return:        The balance expressed in the journal's currency.
docstring_summary: Get the outstanding payments balance of the current journal by filtering the journal items using the
          journal's accounts.
docstring_tokens: Get the outstanding payments balance of the current journal by filtering the journal items using the journal s accounts .
function: def _get_journal_outstanding_payments_account_balance(self, domain=None, date=None):
          ''' Get the outstanding payments balance of the current journal by filtering the journal items using the
          journal's accounts.
  
          :param domain:  An additional domain to be applied on the account.move.line model.
          :param date:    The date to be used when performing the currency conversions.
          :return:        The balance expressed in the journal's currency.
          '''
          self.ensure_one()
          self.env['account.move.line'].check_access_rights('read')
          conversion_date = date or fields.Date.context_today(self)
  
          accounts = self._get_journal_inbound_outstanding_payment_accounts().union(self._get_journal_outbound_outstanding_payment_accounts())
          if not accounts:
              return 0.0, 0
  
          # Allow user managing payments without any statement lines.
          # In that case, the user manages transactions only using the register payment wizard.
          if self.default_account_id in accounts:
              return 0.0, 0
  
          domain = (domain or []) + [
              ('account_id', 'in', tuple(accounts.ids)),
              ('display_type', 'not in', ('line_section', 'line_note')),
              ('parent_state', '!=', 'cancel'),
              ('reconciled', '=', False),
              ('journal_id', '=', self.id),
          ]
          query = self.env['account.move.line']._where_calc(domain)
          tables, where_clause, where_params = query.get_sql()
  
          self._cr.execute('''
              SELECT
                  COUNT(account_move_line.id) AS nb_lines,
                  account_move_line.currency_id,
                  account.reconcile AS is_account_reconcile,
                  SUM(account_move_line.amount_residual) AS amount_residual,
                  SUM(account_move_line.balance) AS balance,
                  SUM(account_move_line.amount_residual_currency) AS amount_residual_currency,
                  SUM(account_move_line.amount_currency) AS amount_currency
              FROM ''' + tables + '''
              JOIN account_account account ON account.id = account_move_line.account_id
              WHERE ''' + where_clause + '''
              GROUP BY account_move_line.currency_id, account.reconcile
          ''', where_params)
  
          company_currency = self.company_id.currency_id
          journal_currency = self.currency_id if self.currency_id and self.currency_id != company_currency else False
          balance_currency = journal_currency or company_currency
  
          total_balance = 0.0
          nb_lines = 0
          for res in self._cr.dictfetchall():
              nb_lines += res['nb_lines']
  
              amount_currency = res['amount_residual_currency'] if res['is_account_reconcile'] else res['amount_currency']
              balance = res['amount_residual'] if res['is_account_reconcile'] else res['balance']
  
              if res['currency_id'] and journal_currency and res['currency_id'] == journal_currency.id:
                  total_balance += amount_currency
              elif journal_currency:
                  total_balance += company_currency._convert(balance, balance_currency, self.company_id, conversion_date)
              else:
                  total_balance += balance
          return total_balance, nb_lines
function_tokens: def _get_journal_outstanding_payments_account_balance ( self , domain = None , date = None ) : self . ensure_one ( ) self . env [ 'account.move.line' ] . check_access_rights ( 'read' ) conversion_date = date or fields . Date . context_today ( self ) accounts = self . _get_journal_inbound_outstanding_payment_accounts ( ) . union ( self . _get_journal_outbound_outstanding_payment_accounts ( ) ) if not accounts : return 0.0 , 0 # Allow user managing payments without any statement lines. # In that case, the user manages transactions only using the register payment wizard. if self . default_account_id in accounts : return 0.0 , 0 domain = ( domain or [ ] ) + [ ( 'account_id' , 'in' , tuple ( accounts . ids ) ) , ( 'display_type' , 'not in' , ( 'line_section' , 'line_note' ) ) , ( 'parent_state' , '!=' , 'cancel' ) , ( 'reconciled' , '=' , False ) , ( 'journal_id' , '=' , self . id ) , ] query = self . env [ 'account.move.line' ] . _where_calc ( domain ) tables , where_clause , where_params = query . get_sql ( ) self . _cr . execute ( '''
              SELECT
                  COUNT(account_move_line.id) AS nb_lines,
                  account_move_line.currency_id,
                  account.reconcile AS is_account_reconcile,
                  SUM(account_move_line.amount_residual) AS amount_residual,
                  SUM(account_move_line.balance) AS balance,
                  SUM(account_move_line.amount_residual_currency) AS amount_residual_currency,
                  SUM(account_move_line.amount_currency) AS amount_currency
              FROM ''' + tables + '''
              JOIN account_account account ON account.id = account_move_line.account_id
              WHERE ''' + where_clause + '''
              GROUP BY account_move_line.currency_id, account.reconcile
          ''' , where_params ) company_currency = self . company_id . currency_id journal_currency = self . currency_id if self . currency_id and self . currency_id != company_currency else False balance_currency = journal_currency or company_currency total_balance = 0.0 nb_lines = 0 for res in self . _cr . dictfetchall ( ) : nb_lines += res [ 'nb_lines' ] amount_currency = res [ 'amount_residual_currency' ] if res [ 'is_account_reconcile' ] else res [ 'amount_currency' ] balance = res [ 'amount_residual' ] if res [ 'is_account_reconcile' ] else res [ 'balance' ] if res [ 'currency_id' ] and journal_currency and res [ 'currency_id' ] == journal_currency . id : total_balance += amount_currency elif journal_currency : total_balance += company_currency . _convert ( balance , balance_currency , self . company_id , conversion_date ) else : total_balance += balance return total_balance , nb_lines