From ece71bba7bf35e7b36877afe9fb757c0bbdfa5be Mon Sep 17 00:00:00 2001 From: Iryna Vushnevska Date: Mon, 28 Jan 2019 02:06:36 +0200 Subject: [PATCH] [IMP] account_financial_reports: Several improvements: * Move to less files to compile variables * hide contacts on partner * Add reports to res partner actions * initialize wizard from context * initialize wizard by current fiscal year --- .../i18n/account_financial_report.pot | 10 +- account_financial_report/i18n/ar.po | 11 +- account_financial_report/i18n/ca.po | 10 +- account_financial_report/i18n/de.po | 12 +- account_financial_report/i18n/es.po | 12 +- account_financial_report/i18n/fr.po | 10 +- account_financial_report/i18n/hr_HR.po | 10 +- account_financial_report/i18n/it.po | 11 +- account_financial_report/i18n/nl.po | 11 +- account_financial_report/i18n/nl_NL.po | 10 +- account_financial_report/i18n/pt.po | 10 +- account_financial_report/i18n/ro.po | 11 +- .../models/account_move_line.py | 1 - account_financial_report/report/open_items.py | 1 + .../js/account_financial_report_backend.js | 183 +++++++++--------- .../js/account_financial_report_widgets.js | 126 ++++++------ .../src/{css/report.css => less/report.less} | 0 .../tests/test_general_ledger.py | 54 ++++++ .../tests/test_open_items.py | 20 ++ .../view/report_template.xml | 2 +- .../wizard/aged_partner_balance_wizard.py | 4 +- .../wizard/general_ledger_wizard.py | 48 ++++- .../wizard/general_ledger_wizard_view.xml | 13 ++ .../wizard/open_items_wizard.py | 24 ++- .../wizard/open_items_wizard_view.xml | 13 ++ .../wizard/trial_balance_wizard.py | 4 +- 26 files changed, 436 insertions(+), 185 deletions(-) rename account_financial_report/static/src/{css/report.css => less/report.less} (100%) diff --git a/account_financial_report/i18n/account_financial_report.pot b/account_financial_report/i18n/account_financial_report.pot index c0a1976c..bb84227c 100644 --- a/account_financial_report/i18n/account_financial_report.pot +++ b/account_financial_report/i18n/account_financial_report.pot @@ -1124,6 +1124,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1678,6 +1679,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2157,13 +2163,13 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "The Company in the General Ledger Report Wizard and in Date Range must be the same." msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "The Company in the Trial Balance Report Wizard and in Date Range must be the same." msgstr "" diff --git a/account_financial_report/i18n/ar.po b/account_financial_report/i18n/ar.po index eb29241c..7e1d1a3d 100644 --- a/account_financial_report/i18n/ar.po +++ b/account_financial_report/i18n/ar.po @@ -1144,6 +1144,7 @@ msgstr "تاريخ بدء السنة المالية" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1711,6 +1712,12 @@ msgstr "دفعات مستحقّة" msgid "Open Items -" msgstr "دفعات مستحقّة" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +msgid "Open Items Partner" +msgstr "دفعات مستحقّة" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2193,7 +2200,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2201,7 +2208,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/ca.po b/account_financial_report/i18n/ca.po index 87d10860..3a60f0a8 100644 --- a/account_financial_report/i18n/ca.po +++ b/account_financial_report/i18n/ca.po @@ -1144,6 +1144,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1703,6 +1704,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2186,7 +2192,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2194,7 +2200,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/de.po b/account_financial_report/i18n/de.po index 43a903b9..dd949fd4 100644 --- a/account_financial_report/i18n/de.po +++ b/account_financial_report/i18n/de.po @@ -1166,6 +1166,7 @@ msgstr "GJ Beginn" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1729,6 +1730,13 @@ msgstr "Offene Posten" msgid "Open Items -" msgstr "Offene Posten -" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +#| msgid "Open Items -" +msgid "Open Items Partner" +msgstr "Offene Posten -" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2218,7 +2226,7 @@ msgid "Taxtags" msgstr "Steuer-Stichwörter" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2228,7 +2236,7 @@ msgstr "" "identisch sein." #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/es.po b/account_financial_report/i18n/es.po index 36215d35..44fc8c7c 100644 --- a/account_financial_report/i18n/es.po +++ b/account_financial_report/i18n/es.po @@ -1159,6 +1159,7 @@ msgstr "Fecha Inicio" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1724,6 +1725,13 @@ msgstr "Partidas abiertas" msgid "Open Items -" msgstr "Partidas abiertas -" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +#| msgid "Open Items -" +msgid "Open Items Partner" +msgstr "Partidas abiertas -" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2205,7 +2213,7 @@ msgid "Taxtags" msgstr "Etiquetas de impuestos" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2215,7 +2223,7 @@ msgstr "" "fechas debe ser la misma." #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/fr.po b/account_financial_report/i18n/fr.po index e8212a72..1e15e3f1 100644 --- a/account_financial_report/i18n/fr.po +++ b/account_financial_report/i18n/fr.po @@ -1146,6 +1146,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1705,6 +1706,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2189,7 +2195,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2197,7 +2203,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/hr_HR.po b/account_financial_report/i18n/hr_HR.po index ac2a1c31..5f5ab447 100644 --- a/account_financial_report/i18n/hr_HR.po +++ b/account_financial_report/i18n/hr_HR.po @@ -1148,6 +1148,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1707,6 +1708,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2191,7 +2197,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2199,7 +2205,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/it.po b/account_financial_report/i18n/it.po index bf63a014..04223f13 100644 --- a/account_financial_report/i18n/it.po +++ b/account_financial_report/i18n/it.po @@ -1146,6 +1146,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1711,6 +1712,12 @@ msgstr "Partite aperte" msgid "Open Items -" msgstr "Partite aperte" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +msgid "Open Items Partner" +msgstr "Partite aperte" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2194,7 +2201,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2202,7 +2209,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/nl.po b/account_financial_report/i18n/nl.po index ea6775a9..7ab56698 100644 --- a/account_financial_report/i18n/nl.po +++ b/account_financial_report/i18n/nl.po @@ -1167,6 +1167,7 @@ msgstr "Fj startdatum" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1740,6 +1741,12 @@ msgstr "Openstaande posten" msgid "Open Items -" msgstr "Openstaande posten" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +msgid "Open Items Partner" +msgstr "Openstaande posten" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2226,7 +2233,7 @@ msgid "Taxtags" msgstr "Belasting labels" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2234,7 +2241,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/nl_NL.po b/account_financial_report/i18n/nl_NL.po index dc5056ae..8dd9a68b 100644 --- a/account_financial_report/i18n/nl_NL.po +++ b/account_financial_report/i18n/nl_NL.po @@ -1147,6 +1147,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1706,6 +1707,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2188,7 +2194,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2196,7 +2202,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/pt.po b/account_financial_report/i18n/pt.po index ad3070ab..d84b7d00 100644 --- a/account_financial_report/i18n/pt.po +++ b/account_financial_report/i18n/pt.po @@ -1146,6 +1146,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1705,6 +1706,11 @@ msgstr "" msgid "Open Items -" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +msgid "Open Items Partner" +msgstr "" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2189,7 +2195,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2197,7 +2203,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/i18n/ro.po b/account_financial_report/i18n/ro.po index b872845a..d56245f0 100644 --- a/account_financial_report/i18n/ro.po +++ b/account_financial_report/i18n/ro.po @@ -1156,6 +1156,7 @@ msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:15 +#: model:ir.actions.act_window,name:account_financial_report.act_action_general_ledger_wizard_partner_relation #: model:ir.actions.act_window,name:account_financial_report.action_general_ledger_wizard #: model:ir.actions.client,name:account_financial_report.action_report_general_ledger #: model:ir.actions.report,name:account_financial_report.action_report_general_ledger_html @@ -1722,6 +1723,12 @@ msgstr "Poziții deschise" msgid "Open Items -" msgstr "Poziții deschise" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.act_action_open_items_wizard_partner_relation +#, fuzzy +msgid "Open Items Partner" +msgstr "Poziții deschise" + #. module: account_financial_report #: model:ir.model,name:account_financial_report.model_open_items_report_wizard msgid "Open Items Report Wizard" @@ -2205,7 +2212,7 @@ msgid "Taxtags" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:160 +#: code:addons/account_financial_report/wizard/general_ledger_wizard.py:196 #, python-format msgid "" "The Company in the General Ledger Report Wizard and in Date Range must be " @@ -2213,7 +2220,7 @@ msgid "" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:163 +#: code:addons/account_financial_report/wizard/trial_balance_wizard.py:165 #, python-format msgid "" "The Company in the Trial Balance Report Wizard and in Date Range must be the " diff --git a/account_financial_report/models/account_move_line.py b/account_financial_report/models/account_move_line.py index fc81af61..70e921e1 100644 --- a/account_financial_report/models/account_move_line.py +++ b/account_financial_report/models/account_move_line.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2019 ACSONE SA/NV () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- from odoo import api, models diff --git a/account_financial_report/report/open_items.py b/account_financial_report/report/open_items.py index 993706b6..f1039151 100644 --- a/account_financial_report/report/open_items.py +++ b/account_financial_report/report/open_items.py @@ -638,6 +638,7 @@ ORDER BY self._compute_account_cumul() def _compute_partner_cumul(self): + # pylint: disable=sql-injection where_condition_partner_by_account = """ WHERE id IN diff --git a/account_financial_report/static/src/js/account_financial_report_backend.js b/account_financial_report/static/src/js/account_financial_report_backend.js index ed8f8643..dd23b5ad 100644 --- a/account_financial_report/static/src/js/account_financial_report_backend.js +++ b/account_financial_report/static/src/js/account_financial_report_backend.js @@ -1,54 +1,57 @@ odoo.define('account_financial_report.account_financial_report_backend', function (require) { -'use strict'; + 'use strict'; -var core = require('web.core'); -var Widget = require('web.Widget'); -var ControlPanelMixin = require('web.ControlPanelMixin'); -var ReportWidget = require('account_financial_report.account_financial_report_widget'); + var core = require('web.core'); + var Widget = require('web.Widget'); + var ControlPanelMixin = require('web.ControlPanelMixin'); + var ReportWidget = require( + 'account_financial_report.account_financial_report_widget' + ); -var report_backend = Widget.extend(ControlPanelMixin, { - // Stores all the parameters of the action. - events: { - 'click .o_account_financial_reports_print': 'print', - 'click .o_account_financial_reports_export': 'export', - }, - init: function(parent, action) { - this.actionManager = parent; - this.given_context = {}; - this.odoo_context = action.context; - this.controller_url = action.context.url; - if (action.context.context) { - this.given_context = action.context.context; - } - this.given_context.active_id = action.context.active_id || action.params.active_id; - this.given_context.model = action.context.active_model || false; - this.given_context.ttype = action.context.ttype || false; - return this._super.apply(this, arguments); - }, - willStart: function() { - return $.when(this.get_html()); - }, - set_html: function() { - var self = this; - var def = $.when(); - if (!this.report_widget) { - this.report_widget = new ReportWidget(this, this.given_context); - def = this.report_widget.appendTo(this.$el); - } - def.then(function () { - self.report_widget.$el.html(self.html); - }); - }, - start: function() { - this.set_html(); - return this._super(); - }, - // Fetches the html and is previous report.context if any, else create it - get_html: function() { - var self = this; - var defs = []; - return this._rpc({ + var report_backend = Widget.extend(ControlPanelMixin, { + // Stores all the parameters of the action. + events: { + 'click .o_account_financial_reports_print': 'print', + 'click .o_account_financial_reports_export': 'export', + }, + init: function (parent, action) { + this.actionManager = parent; + this.given_context = {}; + this.odoo_context = action.context; + this.controller_url = action.context.url; + if (action.context.context) { + this.given_context = action.context.context; + } + this.given_context.active_id = action.context.active_id || + action.params.active_id; + this.given_context.model = action.context.active_model || false; + this.given_context.ttype = action.context.ttype || false; + return this._super.apply (this, arguments); + }, + willStart: function () { + return $.when(this.get_html()); + }, + set_html: function () { + var self = this; + var def = $.when(); + if (!this.report_widget) { + this.report_widget = new ReportWidget(this, this.given_context); + def = this.report_widget.appendTo(this.$el); + } + def.then(function () { + self.report_widget.$el.html(self.html); + }); + }, + start: function() { + this.set_html(); + return this._super(); + }, + // Fetches the html and is previous report.context if any, else create it + get_html: function() { + var self = this; + var defs = []; + return this._rpc({ model: this.given_context.model, method: 'get_html', args: [self.given_context], @@ -59,46 +62,50 @@ var report_backend = Widget.extend(ControlPanelMixin, { defs.push(self.update_cp()); return $.when.apply($, defs); }); - }, - // Updates the control panel and render the elements that have yet to be rendered - update_cp: function() { - if (this.$buttons) { - var status = { - breadcrumbs: this.actionManager.get_breadcrumbs(), - cp_content: {$buttons: this.$buttons}, - }; - return this.update_control_panel(status); - } - }, - do_show: function() { - this._super(); - this.update_cp(); - }, - print: function() { - var self = this; - this._rpc({ - model: this.given_context.model, - method: 'print_report', - args: [this.given_context.active_id, 'qweb-pdf'], - context: self.odoo_context, - }).then(function(result){ - self.do_action(result); - }); - }, - export: function() { - var self = this; - this._rpc({ - model: this.given_context.model, - method: 'print_report', - args: [this.given_context.active_id, 'xlsx'], - context: self.odoo_context, - }) - .then(function(result){ - self.do_action(result); - }); - }, -}); + }, + // Updates the control panel and render the elements that have yet + // to be rendered + update_cp: function () { + if (this.$buttons) { + var status = { + breadcrumbs: this.actionManager.get_breadcrumbs(), + cp_content: {$buttons: this.$buttons}, + }; + return this.update_control_panel(status); + } + }, + do_show: function () { + this._super(); + this.update_cp(); + }, + print: function () { + var self = this; + this._rpc({ + model: this.given_context.model, + method: 'print_report', + args: [this.given_context.active_id, 'qweb-pdf'], + context: self.odoo_context, + }).then(function(result){ + self.do_action(result); + }); + }, + export: function () { + var self = this; + this._rpc({ + model: this.given_context.model, + method: 'print_report', + args: [this.given_context.active_id, 'xlsx'], + context: self.odoo_context, + }) + .then(function(result){ + self.do_action(result); + }); + }, + }); -core.action_registry.add("account_financial_report_backend", report_backend); -return report_backend; + core.action_registry.add( + "account_financial_report_backend", + report_backend + ); + return report_backend; }); diff --git a/account_financial_report/static/src/js/account_financial_report_widgets.js b/account_financial_report/static/src/js/account_financial_report_widgets.js index c423657c..727120d4 100644 --- a/account_financial_report/static/src/js/account_financial_report_widgets.js +++ b/account_financial_report/static/src/js/account_financial_report_widgets.js @@ -1,69 +1,73 @@ odoo.define('account_financial_report.account_financial_report_widget', function (require) { -'use strict'; + 'use strict'; -var Widget = require('web.Widget'); + var Widget = require('web.Widget'); -var accountFinancialReportWidget = Widget.extend({ - events: { - 'click .o_account_financial_reports_web_action': 'boundLink', - 'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti', - 'click .o_account_financial_reports_web_action_monetary': 'boundLinkMonetary', - 'click .o_account_financial_reports_web_action_monetary_multi': 'boundLinkMonetarymulti', - }, - init: function() { - this._super.apply(this, arguments); - }, - start: function() { - return this._super.apply(this, arguments); - }, - boundLink: function(e) { - var res_model = $(e.target).data('res-model'); - var res_id = $(e.target).data('active-id'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - res_id: res_id, - views: [[false, 'form']], - target: 'current' - }); - }, - boundLinkmulti: function(e) { - var res_model = $(e.target).data('res-model'); - var domain = $(e.target).data('domain'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - domain: domain, - views: [[false, "list"], [false, "form"]], - target: 'current' - }); - }, - boundLinkMonetary: function(e) { - var res_model = $(e.target.parentElement).data('res-model'); - var res_id = $(e.target.parentElement).data('active-id'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - res_id: res_id, - views: [[false, 'form']], - target: 'current' - }); - }, - boundLinkMonetarymulti: function(e) { - var res_model = $(e.target.parentElement).data('res-model'); - var domain = $(e.target.parentElement).data('domain'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - domain: domain, - views: [[false, "list"], [false, "form"]], - target: 'current' - }); - }, -}); + var accountFinancialReportWidget = Widget.extend({ + events: { + 'click .o_account_financial_reports_web_action': + 'boundLink', + 'click .o_account_financial_reports_web_action_multi': + 'boundLinkmulti', + 'click .o_account_financial_reports_web_action_monetary': + 'boundLinkMonetary', + 'click .o_account_financial_reports_web_action_monetary_multi': + 'boundLinkMonetarymulti', + }, + init: function () { + this._super.apply(this, arguments); + }, + start: function () { + return this._super.apply(this, arguments); + }, + boundLink: function (e) { + var res_model = $(e.target).data('res-model'); + var res_id = $(e.target).data('active-id'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + res_id: res_id, + views: [[false, 'form']], + target: 'current', + }); + }, + boundLinkmulti: function (e) { + var res_model = $(e.target).data('res-model'); + var domain = $(e.target).data('domain'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + domain: domain, + views: [[false, "list"], [false, "form"]], + target: 'current', + }); + }, + boundLinkMonetary: function (e) { + var res_model = $(e.target.parentElement).data('res-model'); + var res_id = $(e.target.parentElement).data('active-id'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + res_id: res_id, + views: [[false, 'form']], + target: 'current', + }); + }, + boundLinkMonetarymulti: function (e) { + var res_model = $(e.target.parentElement).data('res-model'); + var domain = $(e.target.parentElement).data('domain'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + domain: domain, + views: [[false, "list"], [false, "form"]], + target: 'current', + }); + }, + }); -return accountFinancialReportWidget; + return accountFinancialReportWidget; }); diff --git a/account_financial_report/static/src/css/report.css b/account_financial_report/static/src/less/report.less similarity index 100% rename from account_financial_report/static/src/css/report.css rename to account_financial_report/static/src/less/report.less diff --git a/account_financial_report/tests/test_general_ledger.py b/account_financial_report/tests/test_general_ledger.py index 8e0537e5..ca218b91 100644 --- a/account_financial_report/tests/test_general_ledger.py +++ b/account_financial_report/tests/test_general_ledger.py @@ -493,3 +493,57 @@ class TestGeneralLedgerReport(common.TransactionCase): self.assertEqual(lines['unaffected'].final_debit, 500) self.assertEqual(lines['unaffected'].final_credit, 0) self.assertEqual(lines['unaffected'].final_balance, 500) + + def test_partner_filter(self): + partner_1 = self.env.ref('base.res_partner_1') + partner_2 = self.env.ref('base.res_partner_2') + partner_3 = self.env.ref('base.res_partner_3') + partner_4 = self.env.ref('base.res_partner_4') + partner_1.write({'is_company': False, + 'parent_id': partner_2.id}) + partner_3.write({'is_company': False}) + + expected_list = [partner_2.id, partner_3.id, partner_4.id] + context = { + 'active_ids': [ + partner_1.id, partner_2.id, partner_3.id, partner_4.id + ], + 'active_model': 'res.partner' + } + + wizard = self.env["general.ledger.report.wizard"].with_context(context) + self.assertEqual(wizard._default_partners(), expected_list) + + def test_validate_date(self): + company_id = self.env.ref('base.main_company') + company_id.write({ + 'fiscalyear_last_day': 31, + 'fiscalyear_last_month': 12, + }) + user = self.env.ref('base.user_root').with_context( + company_id=company_id.id) + wizard = self.env["general.ledger.report.wizard"].with_context( + user=user.id + ) + self.assertEqual(wizard._init_date_from(), + time.strftime('%Y') + '-01-01') + + def test_validate_date_range(self): + data_type = self.env['date.range.type'].create({ + 'name': 'Fiscal year', + 'company_id': False, + 'allow_overlap': False + }) + + dr = self.env['date.range'].create({ + 'name': 'FS2015', + 'date_start': '2018-01-01', + 'date_end': '2018-12-31', + 'type_id': data_type.id, + }) + + wizard = self.env["general.ledger.report.wizard"].create({ + 'date_range_id': dr.id}) + wizard.onchange_date_range_id() + self.assertEqual(wizard.date_from, '2018-01-01') + self.assertEqual(wizard.date_to, '2018-12-31') diff --git a/account_financial_report/tests/test_open_items.py b/account_financial_report/tests/test_open_items.py index 197dfb72..5456c135 100644 --- a/account_financial_report/tests/test_open_items.py +++ b/account_financial_report/tests/test_open_items.py @@ -39,3 +39,23 @@ class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency): {'hide_account_at_0': True}, {'only_posted_moves': True, 'hide_account_at_0': True}, ] + + def test_partner_filter(self): + partner_1 = self.env.ref('base.res_partner_1') + partner_2 = self.env.ref('base.res_partner_2') + partner_3 = self.env.ref('base.res_partner_3') + partner_4 = self.env.ref('base.res_partner_4') + partner_1.write({'is_company': False, + 'parent_id': partner_2.id}) + partner_3.write({'is_company': False}) + + expected_list = [partner_2.id, partner_3.id, partner_4.id] + context = { + 'active_ids': [ + partner_1.id, partner_2.id, partner_3.id, partner_4.id + ], + 'active_model': 'res.partner' + } + + wizard = self.env["open.items.report.wizard"].with_context(context) + self.assertEqual(wizard._default_partners(), expected_list) diff --git a/account_financial_report/view/report_template.xml b/account_financial_report/view/report_template.xml index 3eabdcd5..7ec26188 100644 --- a/account_financial_report/view/report_template.xml +++ b/account_financial_report/view/report_template.xml @@ -4,7 +4,7 @@