daily pastebin goal


a guest Mar 15th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                     SELECT
  2.                         linea.account_id,
  3.                         array_agg(linea.id) AS linea_ids,
  4.                         sum(linea.debit) AS debe,
  5.                         sum(linea.credit) AS haber
  6.                     FROM
  7.                         account_voucher voucher
  8.                         LEFT JOIN account_move_line linea ON linea.move_id = voucher.move_id
  9.                                                              OR linea.id IN (SELECT move_line_id FROM account_voucher_line WHERE voucher_id = voucher.id AND amount > 0)
  10.                                                              OR linea.id IN (SELECT aml.id FROM account_voucher_descuento_recargo descuento LEFT JOIN account_invoice ON descuento.comprobante_id = account_invoice.id LEFT JOIN account_move_line aml ON aml.move_id = account_invoice.move_id WHERE descuento.voucher_id = voucher.id)
  11.                         LEFT JOIN account_account cuenta ON linea.account_id = cuenta.id
  12.                     WHERE
  13.                         cuenta.type in ('receivable', 'payable')
  14.                         AND voucher.id = %s
  15.                         AND linea.id 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