a guest Mar 15th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                     SELECT
  2.                         linea.account_id,
  3.                         array_agg( AS linea_ids,
  4.                         sum(linea.debit) AS debe,
  5.                         sum( AS haber
  6.                     FROM
  7.                         account_voucher voucher
  8.                         LEFT JOIN account_move_line linea ON linea.move_id = voucher.move_id
  9.                                                              OR IN (SELECT move_line_id FROM account_voucher_line WHERE voucher_id = AND amount > 0)
  10.                                                              OR IN (SELECT FROM account_voucher_descuento_recargo descuento LEFT JOIN account_invoice ON descuento.comprobante_id = LEFT JOIN account_move_line aml ON aml.move_id = account_invoice.move_id WHERE descuento.voucher_id =
  11.                         LEFT JOIN account_account cuenta ON linea.account_id =
  12.                     WHERE
  13.                         cuenta.type in ('receivable', 'payable')
  14.                         AND = %s
  15.                         AND NOT IN (%s)
  16.                     GROUP BY linea.account_id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand