Browse Source

Merge pull request #341 from Eficent/10.0-mig-account_financial_report_horizontal

[10.0][MIG] account_financial_report_horizontal
pull/339/merge
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
718e1f672b
  1. 36
      account_financial_report_horizontal/README.rst
  2. 2
      account_financial_report_horizontal/__init__.py
  3. 33
      account_financial_report_horizontal/__manifest__.py
  4. 6
      account_financial_report_horizontal/data/ir_actions_report_xml.xml
  5. 6
      account_financial_report_horizontal/data/report_paperformat.xml
  6. 49
      account_financial_report_horizontal/i18n/ca.po
  7. 49
      account_financial_report_horizontal/i18n/de.po
  8. 49
      account_financial_report_horizontal/i18n/es.po
  9. 49
      account_financial_report_horizontal/i18n/fr.po
  10. 49
      account_financial_report_horizontal/i18n/pt.po
  11. 21
      account_financial_report_horizontal/models/__init__.py
  12. 46
      account_financial_report_horizontal/models/account_financial_report.py
  13. 3
      account_financial_report_horizontal/report/__init__.py
  14. 65
      account_financial_report_horizontal/report/report_financial.py
  15. 26
      account_financial_report_horizontal/report/report_financial.xml
  16. 4
      account_financial_report_horizontal/tests/__init__.py
  17. 20
      account_financial_report_horizontal/tests/test_account_financial_report_horizontal.py

36
account_financial_report_horizontal/README.rst

@ -1,21 +1,41 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
Accounting Financial Reports Horizontal
=======================================
======================================
Accounting Financial Report Horizontal
======================================
This addon provides a balance sheet and profit and loss report in landscape mode with assets to the left and liabilities to the right as is common in Italy and the Netherlands.
This module provides a balance sheet and profit and loss report in landscape
mode with assets to the left and liabilities to the right as is common in
Italy and the Netherlands.
Usage Usage
===== =====
After the module is installed, the balance sheet and profit and loss reports will be in landscape mode with assets left and liabilities right.
After the module is installed, the balance sheet and profit and loss reports
will be in landscape mode with assets left and liabilities right.
* https://www.odoo.com/forum/help-1
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/91/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/account-financial-reporting/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits Credits
======= =======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors Contributors
------------ ------------
@ -23,6 +43,8 @@ Contributors
* Holger Brunn <hbrunn@therp.nl> * Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <srijnhart@therp.nl> * Stefan Rijnhart <srijnhart@therp.nl>
Do not contact contributors directly about support or help with technical issues.
Maintainer Maintainer
---------- ----------
@ -36,4 +58,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

2
account_financial_report_horizontal/__init__.py

@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import report from . import report
from . import models from . import models

33
account_financial_report_horizontal/__manifest__.py

@ -1,28 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2012 Therp BV (<http://therp.nl>),
# Copyright (C) 2013 Agile Business Group sagl
# (<http://www.agilebg.com>) (<lorenzo.battistini@agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2012-2016 Therp BV <http://therp.nl>
# © 2013 Agile Business Group sagl <http://www.agilebg.com>
# <lorenzo.battistini@agilebg.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "Accounting Financial Reports Horizontal",
"version": "8.0.0.3.0",
"name": "Accounting Financial Report Horizontal",
"version": "10.0.1.0.0",
"author": "Therp BV,Agile Business Group,Odoo Community Association (OCA)", "author": "Therp BV,Agile Business Group,Odoo Community Association (OCA)",
"category": 'Accounting & Finance', "category": 'Accounting & Finance',
'website': 'https://github.com/OCA/account-financial-reporting', 'website': 'https://github.com/OCA/account-financial-reporting',
@ -33,8 +16,4 @@
"data/ir_actions_report_xml.xml", "data/ir_actions_report_xml.xml",
"report/report_financial.xml", "report/report_financial.xml",
], ],
'demo': [],
'test': [],
'active': False,
'installable': False,
} }

6
account_financial_report_horizontal/data/ir_actions_report_xml.xml

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<odoo>
<record id="account.action_report_financial" model="ir.actions.report.xml"> <record id="account.action_report_financial" model="ir.actions.report.xml">
<field name="paperformat_id" ref="paperformat_euro_landscape" /> <field name="paperformat_id" ref="paperformat_euro_landscape" />
</record> </record>
</data>
</openerp>
</odoo>

6
account_financial_report_horizontal/data/report_paperformat.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record id="paperformat_euro_landscape" model="report.paperformat"> <record id="paperformat_euro_landscape" model="report.paperformat">
<field name="name">European A4 (Landscape)</field> <field name="name">European A4 (Landscape)</field>
<field name="format">A4</field> <field name="format">A4</field>
@ -15,5 +14,4 @@
<field name="header_spacing">35</field> <field name="header_spacing">35</field>
<field name="dpi">90</field> <field name="dpi">90</field>
</record> </record>
</data>
</openerp>
</odoo>

49
account_financial_report_horizontal/i18n/ca.po

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_financial_report_horizontal
#
# Translators:
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-26 02:44+0000\n"
"PO-Revision-Date: 2017-04-26 02:44+0000\n"
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ca\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_account_financial_report
msgid "Account Report"
msgstr "Informe Comptable "
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Balance"
msgstr "Balanç "
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Credit"
msgstr "Crèdit "
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Debit"
msgstr "Dèbit "
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Name"
msgstr "Nom"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_report_account_report_financial
msgid "report.account.report_financial"
msgstr "report.account.report_financial"

49
account_financial_report_horizontal/i18n/de.po

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_financial_report_horizontal
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-20 12:49+0000\n"
"PO-Revision-Date: 2017-01-20 12:49+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_account_financial_report
msgid "Account Report"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Balance"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Credit"
msgstr "Kredit"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Debit"
msgstr "Soll"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Name"
msgstr "Name"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_report_account_report_financial
msgid "report.account.report_financial"
msgstr ""

49
account_financial_report_horizontal/i18n/es.po

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_financial_report_horizontal
#
# Translators:
# Pedro M. Baeza <pedro.baeza@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-16 12:30+0000\n"
"PO-Revision-Date: 2016-12-16 12:30+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>, 2016\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_account_financial_report
msgid "Account Report"
msgstr "Informe de cuentas"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Balance"
msgstr "Saldo"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Credit"
msgstr "Haber"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Debit"
msgstr "Debe"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Name"
msgstr "Nombre"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_report_account_report_financial
msgid "report.account.report_financial"
msgstr "report.account.report_financial"

49
account_financial_report_horizontal/i18n/fr.po

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_financial_report_horizontal
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-16 12:30+0000\n"
"PO-Revision-Date: 2016-12-16 12:30+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_account_financial_report
msgid "Account Report"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Balance"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Credit"
msgstr "Crédit"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Debit"
msgstr "Débit"
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Name"
msgstr "Nom"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_report_account_report_financial
msgid "report.account.report_financial"
msgstr ""

49
account_financial_report_horizontal/i18n/pt.po

@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_financial_report_horizontal
#
# Translators:
# Pedro Castro Silva <pedrocs@sossia.pt>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-01 13:13+0000\n"
"PO-Revision-Date: 2017-05-01 13:13+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@sossia.pt>, 2017\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_account_financial_report
msgid "Account Report"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Balance"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Credit"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Debit"
msgstr ""
#. module: account_financial_report_horizontal
#: model:ir.ui.view,arch_db:account_financial_report_horizontal.report_financial
msgid "Name"
msgstr "Nome"
#. module: account_financial_report_horizontal
#: model:ir.model,name:account_financial_report_horizontal.model_report_account_report_financial
msgid "report.account.report_financial"
msgstr ""

21
account_financial_report_horizontal/models/__init__.py

@ -1,21 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_financial_report from . import account_financial_report

46
account_financial_report_horizontal/models/account_financial_report.py

@ -1,24 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, api
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class AccountFinancialReport(models.Model): class AccountFinancialReport(models.Model):
@ -29,11 +12,11 @@ class AccountFinancialReport(models.Model):
self.ensure_one() self.ensure_one()
if self.type == 'accounts': if self.type == 'accounts':
for account in self.account_ids: for account in self.account_ids:
if account.user_type.report_type not in report_types:
if account.user_type_id.type not in report_types:
return False return False
elif self.type == 'account_type': elif self.type == 'account_type':
for account_type in self.account_type_ids: for account_type in self.account_type_ids:
if account_type.report_type not in report_types:
if account_type.type not in report_types:
return False return False
elif self.type == 'account_report': elif self.type == 'account_report':
# this will have mixed types usually, we rely upon this being # this will have mixed types usually, we rely upon this being
@ -49,23 +32,24 @@ class AccountFinancialReport(models.Model):
if self.env.context.get('account_financial_report_horizontal_side'): if self.env.context.get('account_financial_report_horizontal_side'):
side = self.env.context['account_financial_report_horizontal_side'] side = self.env.context['account_financial_report_horizontal_side']
report_types = { report_types = {
'left': ['income', 'asset', 'none'],
'right': ['expense', 'liability', 'none']
'left': ['receivable', 'liquidity', 'other'],
'right': ['payable', 'other']
}[side] }[side]
last_good_report = None
last_bad_report = None
for report in self.browse(reports):
last_good_report = self.browse([])
last_bad_report = self.browse([])
result = self.browse([])
for report in reports:
if not report.parent_id: if not report.parent_id:
yield report.id
result += report
# don't check children if we already checked the parent # don't check children if we already checked the parent
elif report.parent_id == last_bad_report: elif report.parent_id == last_bad_report:
continue continue
elif report.parent_id == last_good_report\ elif report.parent_id == last_good_report\
or report._has_exclusively_report_types(report_types): or report._has_exclusively_report_types(report_types):
last_good_report = report last_good_report = report
yield report.id
result += report
else: else:
last_bad_report = report last_bad_report = report
return result
else: else:
for report_id in reports:
yield report_id
return reports

3
account_financial_report_horizontal/report/__init__.py

@ -1 +1,4 @@
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import report_financial from . import report_financial

65
account_financial_report_horizontal/report/report_financial.py

@ -1,54 +1,29 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import copy
from openerp import models
from openerp.addons.account.report.account_financial_report import\
report_account_common
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class report_account_common_horizontal(report_account_common):
def __init__(self, cr, uid, name, context=None):
super(report_account_common_horizontal, self).__init__(
cr, uid, name, context=context)
self.localcontext.update({
'get_left_lines': self.get_left_lines,
'get_right_lines': self.get_right_lines,
})
class ReportFinancial(models.AbstractModel):
_inherit = 'report.account.report_financial'
def get_lines(self, data, side=None):
data = copy.deepcopy(data)
if data['form']['used_context'] is None:
data['form']['used_context'] = {}
data['form']['used_context'].update(
account_financial_report_horizontal_side=side)
return super(report_account_common_horizontal, self).get_lines(
data)
def get_account_lines(self, data, side=None):
return super(
ReportFinancial, self.with_context(
account_financial_report_horizontal_side=side,
)
).get_account_lines(data)
def get_left_lines(self, data): def get_left_lines(self, data):
return self.get_lines(data, side='left')
return self.get_account_lines(data, side='left')
def get_right_lines(self, data): def get_right_lines(self, data):
return self.get_lines(data, side='right')
return self.get_account_lines(data, side='right')
class ReportFinancial(models.AbstractModel):
_inherit = 'report.account.report_financial'
_wrapped_report_class = report_account_common_horizontal
@api.multi
def render_html(self, docids, data):
data.setdefault('form', {}).update(
get_left_lines=self.get_left_lines,
get_right_lines=self.get_right_lines,
)
return super(ReportFinancial, self).render_html(docids, data)

26
account_financial_report_horizontal/report/report_financial.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<odoo>
<template id="report_financial" inherit_id="account.report_financial"> <template id="report_financial" inherit_id="account.report_financial">
<!-- replace all tables for different selections and do it in one table /--> <!-- replace all tables for different selections and do it in one table /-->
<!-- with credit/debit /--> <!-- with credit/debit /-->
@ -10,15 +9,15 @@
<!-- filtered without credit/debit /--> <!-- filtered without credit/debit /-->
<xpath expr="//div[@class='page']/table" position="replace"> <xpath expr="//div[@class='page']/table" position="replace">
<div class="row"> <div class="row">
<div class="col-xs-6" t-foreach="[get_left_lines, get_right_lines]" t-as="get_lines_function">
<div class="col-xs-6" t-foreach="[data['get_left_lines'], data['get_right_lines']]" t-as="get_lines_function">
<table class="table table-condensed"> <table class="table table-condensed">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th class="text-right" t-if="data['form']['debit_credit'] == 1">Debit</th>
<th class="text-right" t-if="data['form']['debit_credit'] == 1">Credit</th>
<th class="text-right" t-if="data['debit_credit'] == 1">Debit</th>
<th class="text-right" t-if="data['debit_credit'] == 1">Credit</th>
<th class="text-right">Balance</th> <th class="text-right">Balance</th>
<th class="text-right" t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']"><span t-esc="data['form']['label_filter']"/></th>
<th class="text-right" t-if="data['enable_filter'] == 1 and not data['debit_credit']"><span t-esc="data['label_filter']"/></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -31,14 +30,14 @@
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/> <span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/> <span t-att-style="style" t-esc="a.get('name')"/>
</td> </td>
<td class="text-right" style="white-space: nowrap;" t-if="data['form']['debit_credit'] == 1">
<span t-att-style="style" t-esc="formatLang(a.get('debit'), currency_obj=res_company.currency_id)"/>
<td class="text-right" style="white-space: nowrap;" t-if="['debit_credit'] == 1">
<span t-att-style="style" t-esc="a.get('debit')" t-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td> </td>
<td class="text-right" style="white-space: nowrap;" t-if="data['form']['debit_credit'] == 1">
<span t-att-style="style" t-esc="formatLang(a.get('credit'), currency_obj=res_company.currency_id)"/>
<td class="text-right" style="white-space: nowrap;" t-if="data['debit_credit'] == 1">
<span t-att-style="style" t-esc="a.get('credit')" t-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td> </td>
<td class="text-right"><span t-att-style="style" t-esc="formatLang(a.get('balance'), currency_obj=res_company.currency_id)"/></td>
<td class="text-right" t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']"><span t-att-style="style" t-esc="formatLang(a.get('balance_cmp'), currency_obj=res_company.currency_id)"/></td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/></td>
<td class="text-right" t-if="data['enable_filter'] == 1 and not data['debit_credit']"><span t-att-style="style" t-esc="a.get('balance_cmp')" t-esc-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/></td>
</t> </t>
</tr> </tr>
</tbody> </tbody>
@ -47,5 +46,4 @@
</div> </div>
</xpath> </xpath>
</template> </template>
</data>
</openerp>
</odoo>

4
account_financial_report_horizontal/tests/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_account_financial_report_horizontal

20
account_financial_report_horizontal/tests/test_account_financial_report_horizontal.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from lxml import etree
from odoo.tests.common import TransactionCase
class TestAccountFinancialReportHorizontal(TransactionCase):
def test_account_financial_report_horizontal(self):
action = self.env['accounting.report'].with_context(
active_id=self.env.ref('account.menu_account_report_pl').id,
active_model='ir.ui.view',
).create({}).check_report()
data = action['data']
html = self.env['report'].with_context(action['context']).get_html(
self.env[data['model']].browse(data['ids']),
report_name=action['report_name'],
data=data,
)
self.assertTrue(etree.fromstring(html).xpath('//div[@class="row"]'))
Loading…
Cancel
Save