forked from OCA/l10n-spain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] account_balance_reporting_xls: Exportación a XLS de los informe…
…s financieros
- Loading branch information
1 parent
21f255c
commit 33df0e0
Showing
16 changed files
with
1,011 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Excel export for account balance reporting engine | ||
================================================= | ||
|
||
This module allows to export financial reports to XLS files from print dialog. | ||
|
||
**WARNING:** This module requires module *report_xls*, available on: | ||
|
||
https://github.com/OCA/reporting-engine/ | ||
|
||
Contributors | ||
------------ | ||
* Alejandro Santana <[email protected]> | ||
* Juan Formoso <[email protected]> | ||
* Pedro M. Baeza <[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
################################################################ | ||
# License, author and contributors information in: # | ||
# __openerp__.py file at the root folder of this module. # | ||
################################################################ | ||
|
||
from . import models | ||
from . import report | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# | ||
# Copyright (c) | ||
# 2014 - Anubía, soluciones en la nube,SL (http://www.anubia.es) | ||
# Juan Formoso <[email protected]> | ||
# Alejandro Santana <[email protected]> | ||
# | ||
# 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 | ||
# | ||
############################################################################## | ||
|
||
{ | ||
"name": "Account balance reporting to XLS", | ||
"version": "1.0", | ||
"author": "Spanish Localization Team", | ||
'website': 'http://odoo-spain.org', | ||
"category": "Accounting / Reports", | ||
'depends': [ | ||
'account_balance_reporting', | ||
'report_xls', | ||
], | ||
'contributors': [ | ||
'Alejandro Santana <[email protected]>', | ||
'Juan Formoso <[email protected]>', | ||
'Pedro M. Baeza <[email protected]', | ||
], | ||
'data': [ | ||
'wizard/account_balance_reporting_wizard.xml', | ||
], | ||
'installable': True, | ||
} |
58 changes: 58 additions & 0 deletions
58
account_balance_reporting_xls/i18n/account_balance_reporting_xls.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_balance_reporting_xls | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-01-17 15:55+0000\n" | ||
"PO-Revision-Date: 2015-01-17 15:55+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: view:account.balance.reporting.print.wizard:account_balance_reporting_xls.wizard_account_balance_reporting_xls_print | ||
msgid "Export" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:65 | ||
#, python-format | ||
msgid "Concept" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:70 | ||
#, python-format | ||
msgid "Code" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:75 | ||
#, python-format | ||
msgid "Previous value" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:82 | ||
#, python-format | ||
msgid "Current value" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:89 | ||
#, python-format | ||
msgid "Balance" | ||
msgstr "" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:96 | ||
#, python-format | ||
msgid "Notes" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_balance_reporting_xls | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-01-17 15:55+0000\n" | ||
"PO-Revision-Date: 2015-01-17 15:55+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: view:account.balance.reporting.print.wizard:account_balance_reporting_xls.wizard_account_balance_reporting_xls_print | ||
msgid "Export" | ||
msgstr "Exportar" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:65 | ||
#, python-format | ||
msgid "Concept" | ||
msgstr "Concepto" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:70 | ||
#, python-format | ||
msgid "Code" | ||
msgstr "Código" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:75 | ||
#, python-format | ||
msgid "Previous value" | ||
msgstr "Valor anterior" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:82 | ||
#, python-format | ||
msgid "Current value" | ||
msgstr "Valor actual" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:89 | ||
#, python-format | ||
msgid "Balance" | ||
msgstr "Saldo" | ||
|
||
#. module: account_balance_reporting_xls | ||
#: code:addons/account_balance_reporting_xls/report/reporting_xls.py:96 | ||
#, python-format | ||
msgid "Notes" | ||
msgstr "Notas" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
################################################################ | ||
# License, author and contributors information in: # | ||
# __openerp__.py file at the root folder of this module. # | ||
################################################################ | ||
|
||
from . import account_balance_reporting |
31 changes: 31 additions & 0 deletions
31
account_balance_reporting_xls/models/account_balance_reporting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# License, author and contributors information in: | ||
# __openerp__.py file at the root folder of this module. | ||
|
||
from openerp.osv import orm | ||
|
||
|
||
class AccountBalanceReporting(orm.Model): | ||
_inherit = "account.balance.reporting" | ||
|
||
def _report_xls_document_extra(self, cr, uid, context): | ||
"""Inherit this for adding/changing document references. | ||
""" | ||
return "" | ||
|
||
def _report_xls_fields(self, cr, uid, context=None): | ||
"""Inherit this for adding/changing fields to export to XLS file. | ||
""" | ||
return [ | ||
'name', # account.balance.reporting.line, name | ||
'code', | ||
'notes', | ||
'previous_value', | ||
'current_value', | ||
'balance', | ||
] | ||
|
||
def _report_xls_template(self, cr, uid, context=None): | ||
"""Inherit this for adding/changing template entries. | ||
""" | ||
return {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
################################################################ | ||
# License, author and contributors information in: # | ||
# __openerp__.py file at the root folder of this module. # | ||
################################################################ | ||
|
||
from . import reporting_xls | ||
from . import reporting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# -*- coding: utf-8 -*- | ||
# License, author and contributors information in: | ||
# __openerp__.py file at the root folder of this module. | ||
|
||
import time | ||
from openerp.report import report_sxw | ||
from openerp.tools.translate import translate | ||
|
||
_ir_translation_name = 'account.balance.reporting.print' | ||
|
||
|
||
class AccountBalanceReportingPrint(report_sxw.rml_parse): | ||
|
||
def set_context(self, objects, data, ids, report_type=None): | ||
super(AccountBalanceReportingPrint, self).set_context( | ||
objects, data, ids) | ||
self.report_type = report_type | ||
self.report_id = data['report_id'] | ||
self.report_name = data['report_name'] | ||
self.report_design = data['report_design'] | ||
self.localcontext.update({ | ||
'additional_data': self._get_additional_data(), | ||
}) | ||
|
||
def __init__(self, cr, uid, name, context): | ||
super(AccountBalanceReportingPrint, self).__init__( | ||
cr, uid, name, context=context) | ||
self.localcontext.update({ | ||
'time': time, | ||
'lines': self._lines, | ||
'_': self._, | ||
}) | ||
self.context = context | ||
|
||
def _(self, src): | ||
lang = self.context.get('lang', 'en_US') | ||
return translate(self.cr, _ir_translation_name, 'report', lang, | ||
src) or src | ||
|
||
def _get_additional_data(self): | ||
abr_obj = self.pool['account.balance.reporting'] | ||
abr = abr_obj.browse( | ||
self.cr, self.uid, self.report_id, self.context) | ||
fields = { | ||
'calc_date': abr and abr.calc_date or False, | ||
'tname': abr and abr.template_id and abr.template_id.name or False, | ||
} | ||
return fields | ||
|
||
def _lines(self, obj): | ||
user = self.pool['res.users'].browse(self.cr, self.uid, self.uid) | ||
ctx_lang = {'lang': user.lang} | ||
zero_report = self.pool['ir.model.data'].get_object( | ||
self.cr, self.uid, 'account_balance_reporting', | ||
'report_account_balance_reporting_default_non_zero', | ||
context=ctx_lang) | ||
non_zero = self.report_design == zero_report.name | ||
# No SQL is used, as performance should not be a problem using | ||
# already calculated values. | ||
lines = [] | ||
for line in obj.line_ids: | ||
line_balance = (line.current_value - line.previous_value) | ||
if non_zero and abs(line_balance) < 0.005: | ||
continue | ||
notes = line.notes and line.notes.encode('utf-8') or '' | ||
line_fields = { | ||
'code': line.code, | ||
'name': line.name, | ||
'previous_value': line.previous_value, | ||
'current_value': line.current_value, | ||
'balance': line_balance, | ||
'notes': notes, | ||
} | ||
lines.append(line_fields) | ||
return lines | ||
|
||
report_sxw.report_sxw( | ||
'report.account.balance.reporting.print', 'account.balance.reporting', | ||
parser=AccountBalanceReportingPrint, header=False) |
Oops, something went wrong.