parameters: (self, options)
return_statement: return self.env.cr.mogrify(query, conversion_rates).decode(self.env.cr.connection.encoding)
docstring: Construct the currency table as a mapping company -> rate to convert the amount to the user's company
          currency in a multi-company/multi-currency environment.
          The currency_table is a small postgresql table construct with VALUES.
          :param options: The report options.
          :return:        The query representing the currency table.
docstring_summary: Construct the currency table as a mapping company -> rate to convert the amount to the user's company
          currency in a multi-company/multi-currency environment.
          The currency_table is a small postgresql table construct with VALUES.
          :param options: The report options.
          :return:        The query representing the currency table.
docstring_tokens: Construct the currency table as a mapping company - > rate to convert the amount to the user s company currency in a multi - company / multi - currency environment . The currency_table is a small postgresql table construct with VALUES . : param options : The report options . : return : The query representing the currency table .
function: def _get_query_currency_table(self, options):
          ''' Construct the currency table as a mapping company -> rate to convert the amount to the user's company
          currency in a multi-company/multi-currency environment.
          The currency_table is a small postgresql table construct with VALUES.
          :param options: The report options.
          :return:        The query representing the currency table.
          '''
  
          user_company = self.env.company
          user_currency = user_company.currency_id
          if options.get('multi_company', False):
              companies = self.env.companies
              conversion_date = options['date']['date_to']
              currency_rates = companies.mapped('currency_id')._get_rates(user_company, conversion_date)
          else:
              companies = user_company
              currency_rates = {user_currency.id: 1.0}
  
          conversion_rates = []
          for company in companies:
              conversion_rates.extend((
                  company.id,
                  currency_rates[user_company.currency_id.id] / currency_rates[company.currency_id.id],
                  user_currency.decimal_places,
              ))
          query = '(VALUES %s) AS currency_table(company_id, rate, precision)' % ','.join('(%s, %s, %s)' for i in companies)
          return self.env.cr.mogrify(query, conversion_rates).decode(self.env.cr.connection.encoding)
function_tokens: def _get_query_currency_table ( self , options ) : user_company = self . env . company user_currency = user_company . currency_id if options . get ( 'multi_company' , False ) : companies = self . env . companies conversion_date = options [ 'date' ] [ 'date_to' ] currency_rates = companies . mapped ( 'currency_id' ) . _get_rates ( user_company , conversion_date ) else : companies = user_company currency_rates = { user_currency . id : 1.0 } conversion_rates = [ ] for company in companies : conversion_rates . extend ( ( company . id , currency_rates [ user_company . currency_id . id ] / currency_rates [ company . currency_id . id ] , user_currency . decimal_places , ) ) query = '(VALUES %s) AS currency_table(company_id, rate, precision)' % ',' . join ( '(%s, %s, %s)' for i in companies ) return self . env . cr . mogrify ( query , conversion_rates ) . decode ( self . env . cr . connection . encoding )