Amélioration recherche écritures au crédit du compte d'une immobilisation

This commit is contained in:
Jean-Christophe Engel 2026-05-04 08:34:39 +02:00
parent 62692ef550
commit d06dd424b3

View file

@ -38,7 +38,6 @@
{{* {{*
lister les écritures au crédit du compte de l'immobilisation lister les écritures au crédit du compte de l'immobilisation
variante : utiliser une jointure ; pas forcément plus efficace
*}} *}}
{{#select {{#select
line.id as credit_line_id, line.id as credit_line_id,
@ -57,14 +56,12 @@
INNER JOIN acc_accounts AS account ON account.id = line.id_account INNER JOIN acc_accounts AS account ON account.id = line.id_account
INNER JOIN acc_years AS y ON y.id = trans.id_year INNER JOIN acc_years AS y ON y.id = trans.id_year
WHERE account.code = :account_code AND credit > 0 WHERE account.code = :account_code AND credit > 0
AND credit_trans_id NOT IN ( AND credit_line_id NOT IN (
SELECT SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
CASE WHEN id_transaction = credit_trans_id THEN id_transaction WHERE json_extract(link.document, '$.type') == "immo_link")
ELSE id_related
END AS other_id
FROM acc_transactions_links WHERE other_id = credit_trans_id)
ORDER BY trans.date, trans.label; ORDER BY trans.date, trans.label;
:account_code = $ligne_immo.account_code :account_code = $ligne_immo.account_code
!table =$module.table
assign="other_immos." assign="other_immos."
}} }}
{{/select}} {{/select}}