diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index 476905a42e2..e09b63e7340 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -234,9 +234,13 @@ class AccountFrFec(models.TransientModel): %s AS EcritureDate, MIN(aa.code) AS CompteNum, replace(MIN(aa.name), '|', '/') AS CompteLib, - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID ' || rp.id, '') - ELSE replace(rp.ref, '|', '/') + CASE WHEN MIN(aat.type) IN ('receivable', 'payable') + THEN + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN rp.id::text + ELSE replace(rp.ref, '|', '/') + END + ELSE '' END AS CompAuxNum, COALESCE(replace(rp.name, '|', '/'), '') AS CompAuxLib, @@ -292,9 +296,13 @@ class AccountFrFec(models.TransientModel): TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, aa.code AS CompteNum, replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID ' || rp.id, '') - ELSE replace(rp.ref, '|', '/') + CASE WHEN aat.type IN ('receivable', 'payable') + THEN + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN rp.id::text + ELSE replace(rp.ref, '|', '/') + END + ELSE '' END AS CompAuxNum, COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') AS CompAuxLib, @@ -323,6 +331,7 @@ class AccountFrFec(models.TransientModel): LEFT JOIN res_partner rp ON rp.id=aml.partner_id JOIN account_journal aj ON aj.id = am.journal_id JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id LEFT JOIN res_currency rc ON rc.id = aml.currency_id LEFT JOIN account_full_reconcile rec ON rec.id = aml.full_reconcile_id WHERE