From 72899150027522636bcf4e864da56dbe296c4abb Mon Sep 17 00:00:00 2001 From: Louis Bettens Date: Tue, 18 Oct 2016 09:24:20 +0200 Subject: [PATCH] Qweb: honor translated account names (#227) [IMP] account_financial_report_qweb: honor translated account names --- account_financial_report_qweb/i18n/fr.po | 4 ++-- account_financial_report_qweb/report/general_ledger.py | 8 +++++++- account_financial_report_qweb/report/open_items.py | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/account_financial_report_qweb/i18n/fr.po b/account_financial_report_qweb/i18n/fr.po index 3d0f886d..6a648297 100644 --- a/account_financial_report_qweb/i18n/fr.po +++ b/account_financial_report_qweb/i18n/fr.po @@ -985,7 +985,7 @@ msgstr "Écritures comptabilisées seulement" #: model:ir.ui.view,arch_db:account_financial_report_qweb.report_open_items_qweb #, python-format msgid "Open Items" -msgstr "Écritures non léttrées" +msgstr "Écritures non lettrées" #. module: account_financial_report_qweb #: model:ir.model,name:account_financial_report_qweb.model_open_items_report_wizard @@ -995,7 +995,7 @@ msgstr "Open Items Report Wizard" #. module: account_financial_report_qweb #: model:ir.actions.report.xml,name:account_financial_report_qweb.action_report_open_items_xlsx msgid "Open Items XLSX" -msgstr "Écritures non léttrées XLSX" +msgstr "Écritures non lettrées XLSX" #. module: account_financial_report_qweb #: model:ir.model.fields,field_description:account_financial_report_qweb.field_report_aged_partner_balance_qweb_open_items_id diff --git a/account_financial_report_qweb/report/general_ledger.py b/account_financial_report_qweb/report/general_ledger.py index c2399a53..0449aab7 100644 --- a/account_financial_report_qweb/report/general_ledger.py +++ b/account_financial_report_qweb/report/general_ledger.py @@ -413,7 +413,7 @@ SELECT NOW() AS create_date, a.id AS account_id, a.code, - a.name, + COALESCE(tr.value, a.name) AS name, COALESCE(i.debit, 0.0) AS initial_debit, COALESCE(i.credit, 0.0) AS initial_credit, COALESCE(i.balance, 0.0) AS initial_balance, @@ -427,6 +427,11 @@ LEFT JOIN initial_sum_amounts i ON a.id = i.account_id LEFT JOIN final_sum_amounts f ON a.id = f.account_id +LEFT JOIN + ir_translation tr ON a.id = tr.res_id + AND tr.lang = %s + AND tr.type = 'model' + AND tr.name = 'account.account,name' WHERE ( i.debit IS NOT NULL AND i.debit != 0 @@ -492,6 +497,7 @@ AND query_inject_account_params += ( self.id, self.env.uid, + self.env.lang, ) self.env.cr.execute(query_inject_account, query_inject_account_params) diff --git a/account_financial_report_qweb/report/open_items.py b/account_financial_report_qweb/report/open_items.py index 50a8920f..b8bff704 100644 --- a/account_financial_report_qweb/report/open_items.py +++ b/account_financial_report_qweb/report/open_items.py @@ -233,9 +233,14 @@ SELECT NOW() AS create_date, a.id AS account_id, a.code, - a.name + COALESCE(tr.value, a.name) AS name FROM accounts a +LEFT JOIN + ir_translation tr ON a.id = tr.res_id + AND tr.lang = %s + AND tr.type = 'model' + AND tr.name = 'account.account,name' """ query_inject_account_params = ( self.date_at, @@ -252,6 +257,7 @@ FROM query_inject_account_params += ( self.id, self.env.uid, + self.env.lang, ) self.env.cr.execute(query_inject_account, query_inject_account_params)