Browse Source

[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
pull/663/head
Iryna Vushnevska 5 years ago
committed by Ernesto Tejeda
parent
commit
59a8c10a71
  1. 10
      account_financial_report/i18n/account_financial_report.pot
  2. 11
      account_financial_report/i18n/ar.po
  3. 10
      account_financial_report/i18n/ca.po
  4. 12
      account_financial_report/i18n/de.po
  5. 12
      account_financial_report/i18n/es.po
  6. 10
      account_financial_report/i18n/fr.po
  7. 10
      account_financial_report/i18n/hr_HR.po
  8. 11
      account_financial_report/i18n/it.po
  9. 11
      account_financial_report/i18n/nl.po
  10. 10
      account_financial_report/i18n/nl_NL.po
  11. 10
      account_financial_report/i18n/pt.po
  12. 11
      account_financial_report/i18n/ro.po
  13. 1
      account_financial_report/models/account_move_line.py
  14. 1
      account_financial_report/report/open_items.py
  15. 183
      account_financial_report/static/src/js/account_financial_report_backend.js
  16. 126
      account_financial_report/static/src/js/account_financial_report_widgets.js
  17. 0
      account_financial_report/static/src/less/report.less
  18. 54
      account_financial_report/tests/test_general_ledger.py
  19. 20
      account_financial_report/tests/test_open_items.py
  20. 2
      account_financial_report/view/report_template.xml
  21. 4
      account_financial_report/wizard/aged_partner_balance_wizard.py
  22. 48
      account_financial_report/wizard/general_ledger_wizard.py
  23. 13
      account_financial_report/wizard/general_ledger_wizard_view.xml
  24. 24
      account_financial_report/wizard/open_items_wizard.py
  25. 13
      account_financial_report/wizard/open_items_wizard_view.xml
  26. 4
      account_financial_report/wizard/trial_balance_wizard.py

10
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 ""

11
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 "

10
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 "

12
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 "

12
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 "

10
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 "

10
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 "

11
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 "

11
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 "

10
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 "

10
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 "

11
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 "

1
account_financial_report/models/account_move_line.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import api, models

1
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

183
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;
});

126
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;
});

0
account_financial_report/static/src/css/report.css → account_financial_report/static/src/less/report.less

54
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')

20
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)

2
account_financial_report/view/report_template.xml

@ -4,7 +4,7 @@
<template id="account_financial_report_assets_backend"
name="account_financial_report assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link href="/account_financial_report/static/src/css/report.css" rel="stylesheet"/>
<link href="/account_financial_report/static/src/less/report.less" rel="stylesheet"/>
<script type="text/javascript"
src="/account_financial_report/static/src/js/account_financial_report_backend.js"/>
<script type="text/javascript"

4
account_financial_report/wizard/aged_partner_balance_wizard.py

@ -60,8 +60,10 @@ class AgedPartnerBalanceWizard(models.TransientModel):
res['domain']['account_ids'] += [
('company_id', '=', self.company_id.id)]
res['domain']['partner_ids'] += [
'&',
'|', ('company_id', '=', self.company_id.id),
('company_id', '=', False)]
('company_id', '=', False),
('parent_id', '=', False)]
return res
@api.onchange('receivable_accounts_only', 'payable_accounts_only')

48
account_financial_report/wizard/general_ledger_wizard.py

@ -11,6 +11,7 @@ from odoo import api, fields, models, _
from odoo.tools.safe_eval import safe_eval
from odoo.tools import pycompat
from odoo.exceptions import ValidationError
import time
class GeneralLedgerReportWizard(models.TransientModel):
@ -29,8 +30,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
comodel_name='date.range',
string='Date range'
)
date_from = fields.Date(required=True)
date_to = fields.Date(required=True)
date_from = fields.Date(required=True,
default=lambda self: self._init_date_from())
date_to = fields.Date(required=True,
default=fields.Date.context_today)
fy_start_date = fields.Date(compute='_compute_fy_start_date')
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')],
@ -58,6 +61,7 @@ class GeneralLedgerReportWizard(models.TransientModel):
partner_ids = fields.Many2many(
comodel_name='res.partner',
string='Filter partners',
default=lambda self: self._default_partners(),
)
analytic_tag_ids = fields.Many2many(
comodel_name='account.analytic.tag',
@ -80,9 +84,38 @@ class GeneralLedgerReportWizard(models.TransientModel):
string='Show foreign currency',
help='Display foreign currency for move lines, unless '
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
'will display initial and final balance in that currency.',
default=lambda self: self._default_foreign_currency(),
)
def _init_date_from(self):
"""set start date to begin of current year if fiscal year running"""
today = fields.Date.context_today(self)
cur_month = fields.Date.from_string(today).month
cur_day = fields.Date.from_string(today).day
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
if cur_month < last_fsc_month \
or cur_month == last_fsc_month and cur_day <= last_fsc_day:
return time.strftime('%Y-01-01')
def _default_foreign_currency(self):
return self.env.user.has_group('base.group_multi_currency')
def _default_partners(self):
context = self.env.context
if context.get('active_ids') and context.get('active_model') \
== 'res.partner':
partner_ids = context['active_ids']
corp_partners = self.env['res.partner'].browse(partner_ids). \
filtered(lambda p: p.parent_id)
partner_ids = set(partner_ids) - set(corp_partners.ids)
partner_ids |= set(corp_partners.mapped('parent_id.id'))
return list(partner_ids)
@api.depends('date_from')
def _compute_fy_start_date(self):
for wiz in self.filtered('date_from'):
@ -135,8 +168,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
res['domain']['account_journal_ids'] += [
('company_id', '=', self.company_id.id)]
res['domain']['partner_ids'] += [
'&',
'|', ('company_id', '=', self.company_id.id),
('company_id', '=', False)]
('company_id', '=', False),
('parent_id', '=', False)]
res['domain']['cost_center_ids'] += [
('company_id', '=', self.company_id.id)]
res['domain']['date_range_id'] += [
@ -147,8 +182,9 @@ class GeneralLedgerReportWizard(models.TransientModel):
@api.onchange('date_range_id')
def onchange_date_range_id(self):
"""Handle date range change."""
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
if self.date_range_id:
self.date_from = self.date_range_id.date_start
self.date_to = self.date_range_id.date_end
@api.multi
@api.constrains('company_id', 'date_range_id')

13
account_financial_report/wizard/general_ledger_wizard_view.xml

@ -85,4 +85,17 @@
view_id="general_ledger_wizard"
target="new" />
<!--Add to res.partner action-->
<act_window id="act_action_general_ledger_wizard_partner_relation"
name="General Ledger"
res_model="general.ledger.report.wizard"
src_model="res.partner"
view_mode="form"
context="{
'default_receivable_accounts_only':1,
'default_payable_accounts_only':1,
}"
key2="client_action_multi"
target="new" />
</odoo>

24
account_financial_report/wizard/open_items_wizard.py

@ -44,14 +44,32 @@ class OpenItemsReportWizard(models.TransientModel):
partner_ids = fields.Many2many(
comodel_name='res.partner',
string='Filter partners',
default=lambda self: self._default_partners(),
)
foreign_currency = fields.Boolean(
string='Show foreign currency',
help='Display foreign currency for move lines, unless '
'account currency is not setup through chart of accounts '
'will display initial and final balance in that currency.'
'will display initial and final balance in that currency.',
default=lambda self: self._default_foreign_currency(),
)
def _default_foreign_currency(self):
return self.env.user.has_group('base.group_multi_currency')
def _default_partners(self):
context = self.env.context
if context.get('active_ids') and context.get('active_model') \
== 'res.partner':
partner_ids = context['active_ids']
corp_partners = self.env['res.partner'].browse(partner_ids). \
filtered(lambda p: p.parent_id)
partner_ids = set(partner_ids) - set(corp_partners.ids)
partner_ids |= set(corp_partners.mapped('parent_id.id'))
return list(partner_ids)
@api.onchange('company_id')
def onchange_company_id(self):
"""Handle company change."""
@ -73,8 +91,10 @@ class OpenItemsReportWizard(models.TransientModel):
res['domain']['account_ids'] += [
('company_id', '=', self.company_id.id)]
res['domain']['partner_ids'] += [
'&',
'|', ('company_id', '=', self.company_id.id),
('company_id', '=', False)]
('company_id', '=', False),
('parent_id', '=', False)]
return res
@api.onchange('receivable_accounts_only', 'payable_accounts_only')

13
account_financial_report/wizard/open_items_wizard_view.xml

@ -58,4 +58,17 @@
view_id="open_items_wizard"
target="new" />
<!--Add to res.partner action-->
<act_window id="act_action_open_items_wizard_partner_relation"
name="Open Items Partner"
res_model="open.items.report.wizard"
src_model="res.partner"
view_mode="form"
context="{
'default_receivable_accounts_only':1,
'default_payable_accounts_only':1,
}"
key2="client_action_multi"
target="new" />
</odoo>

4
account_financial_report/wizard/trial_balance_wizard.py

@ -138,8 +138,10 @@ class TrialBalanceReportWizard(models.TransientModel):
res['domain']['account_ids'] += [
('company_id', '=', self.company_id.id)]
res['domain']['partner_ids'] += [
'&',
'|', ('company_id', '=', self.company_id.id),
('company_id', '=', False)]
('company_id', '=', False),
('parent_id', '=', False)]
res['domain']['date_range_id'] += [
'|', ('company_id', '=', self.company_id.id),
('company_id', '=', False)]

Loading…
Cancel
Save