From 7efff597e50ead8d797eb9065c5862046b23435a Mon Sep 17 00:00:00 2001 From: wan Date: Mon, 27 Jan 2020 09:51:51 +0000 Subject: [PATCH] [FIX] l10n_fr_fec: CompAuxNum changes opw-2122776 * CompAuxNum should be the code of the account concatenated with the id of the client * It should be popuated only if it is a receivable/payable The problem is the export of the partner ID in the column G "CompAuxNum". We only export the ID of the linked customer/vendor. When they import the FEC into their software to make tax declarations and annual accounts. The system will notice if an account is filled in in the column G and will override the account in column E with the ID of the partner. As the ID is not a real account, they cannot use the FEC to import correctly. closes odoo/odoo#44297 X-original-commit: 955eec233f2a3129dfddca06ad43a426b3cd4061 Signed-off-by: wan --- addons/l10n_fr_fec/wizard/account_fr_fec.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) 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