[MRG] [ADD] new module account_journal_report_xls
This module adds journal reports by period and by fiscal year with - entries printed per move - option to group entries with same general account & VAT case - vat info per entry - vat summary These reports are available in PDF and XLS format. The columns in XLS exports can be tailored by extending the XLS template in an inherited module.pull/7/merge
commit
ff07192623
|
@ -0,0 +1,27 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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 . import account_journal
|
||||
from . import wizard
|
||||
from . import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,57 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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': 'Financial Journal reports',
|
||||
'version': '0.1',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Noviat',
|
||||
'category': 'Accounting & Finance',
|
||||
'description': """
|
||||
|
||||
Journal Reports
|
||||
===============
|
||||
|
||||
This module adds journal reports by period and by fiscal year with
|
||||
- entries printed per move
|
||||
- option to group entries with same general account & VAT case
|
||||
- vat info per entry
|
||||
- vat summary
|
||||
|
||||
These reports are available in PDF and XLS format.
|
||||
|
||||
This module depends upon the 'report_xls' module,
|
||||
cf. https://launchpad.net/openerp-reporting-engines
|
||||
|
||||
""",
|
||||
'depends': [
|
||||
'account_voucher',
|
||||
'report_xls',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'wizard/print_journal_wizard.xml',
|
||||
],
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,84 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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.osv import orm
|
||||
from openerp.addons.report_xls.utils import rowcol_to_cell, _render
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
class account_journal(orm.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
# allow inherited modules to extend the query
|
||||
def _report_xls_query_extra(self, cr, uid, context=None):
|
||||
select_extra = ""
|
||||
join_extra = ""
|
||||
where_extra = ""
|
||||
return (select_extra, join_extra, where_extra)
|
||||
|
||||
# allow inherited modules to add document references
|
||||
def _report_xls_document_extra(self, cr, uid, context):
|
||||
return "''"
|
||||
|
||||
# override list in inherited module to add/drop columns or change order
|
||||
def _report_xls_fields(self, cr, uid, context=None):
|
||||
res = [
|
||||
'move_name', # account.move,name
|
||||
'move_date', # account.move,date
|
||||
'acc_code', # account.account,code
|
||||
]
|
||||
if context.get('print_by') == 'fiscalyear':
|
||||
res += [
|
||||
'period', # account.period,code or name
|
||||
]
|
||||
res += [
|
||||
'partner_name', # res.partner,name
|
||||
'aml_name', # account.move.line,name
|
||||
'tax_code', # account.tax.code,code
|
||||
'tax_amount', # account.move.line,tax_amount
|
||||
'debit', # account.move.line,debit
|
||||
'credit', # account.move.line,credit
|
||||
'balance', # debit-credit
|
||||
'docname', # origin document if any
|
||||
#'date_maturity', # account.move.line,date_maturity
|
||||
#'reconcile', # account.move.line,reconcile_id.name
|
||||
#'reconcile_partial', # account.move.line,reconcile_partial_id.name
|
||||
#'partner_ref', # res.partner,ref
|
||||
#'move_ref', # account.move,ref
|
||||
#'move_id', # account.move,id
|
||||
]
|
||||
return res
|
||||
|
||||
# Change/Add Template entries
|
||||
def _report_xls_template(self, cr, uid, context=None):
|
||||
"""
|
||||
Template updates, e.g.
|
||||
|
||||
my_change = {
|
||||
'move_name':{
|
||||
'header': [1, 20, 'text', _render("_('My Move Title')")],
|
||||
'lines': [1, 0, 'text', _render("l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
}
|
||||
return my_change
|
||||
"""
|
||||
return {}
|
|
@ -0,0 +1,256 @@
|
|||
# French translation of OpenERP Server 6.1.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_journal_report_xls
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.1\n"
|
||||
"Report-Msgid-Bugs-To: support@noviat.be\n"
|
||||
"POT-Creation-Date: 2013-11-23 17:11:14.941000\n"
|
||||
"PO-Revision-Date: 2013-11-23 17:11:14.941000\n"
|
||||
"Last-Translator: Luc De Meyer (Noviat nv/sa)\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.actions.act_window,name:account_journal_report_xls.action_print_journal_by_period_xls
|
||||
msgid "Journal by Period"
|
||||
msgstr "Journal détaillé par période"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.actions.act_window,name:account_journal_report_xls.action_print_journal_by_fiscalyear_xls
|
||||
msgid "Journal by Fiscal Year"
|
||||
msgstr "Journal détaillé par exercice fiscal"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.ui.menu,name:account_journal_report_xls.menu_print_journal_by_period_xls
|
||||
msgid "Journal by Period"
|
||||
msgstr "Journal détaillé par période"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.ui.menu,name:account_journal_report_xls.menu_print_journal_by_fiscalyear_xls
|
||||
msgid "Journal by Fiscal Year"
|
||||
msgstr "Journal détaillé par exercice fiscal"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,chart_account_id:0
|
||||
msgid "Chart of Account"
|
||||
msgstr "Plan comptable"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,fiscalyear_id:0
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Exercice fiscal"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,target_move:0
|
||||
msgid "Target Moves"
|
||||
msgstr "Mouvements ciblés"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,target_move:0
|
||||
msgid "All Posted Entries"
|
||||
msgstr "Toutes les écritures passées"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,target_move:0
|
||||
msgid "All Entries"
|
||||
msgstr "Toutes les écritures"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,sort_selection:0
|
||||
msgid "Entries Sorted by"
|
||||
msgstr "Écritures triées par"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,sort_selection:0
|
||||
msgid "Journal Entry Number"
|
||||
msgstr "N° écriture dans le journal"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,sort_selection:0
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,amount_currency:0
|
||||
msgid "With Currency"
|
||||
msgstr "Avec devise"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,group_entries:0
|
||||
msgid "Group Entries"
|
||||
msgstr "Group Entries"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,period_from:0
|
||||
msgid "Start Period"
|
||||
msgstr "Première période"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,period_to:0
|
||||
msgid "End Period"
|
||||
msgstr "Dernière période"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: code:addons/account_journal_report_xls/wizard/print_journal_wizard.py:10
|
||||
msgid "No records found for your selection!"
|
||||
msgstr "Aucun enregistrement trouvé pour votre sélection!"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: code:addons/account_journal_report_xls/wizard/print_journal_wizard.py:11
|
||||
msgid "No Data Available"
|
||||
msgstr "Aucune donnée disponible"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Period"
|
||||
msgstr "Période"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Exercice fiscal"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Journal Overview"
|
||||
msgstr "Journal détaillé"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry"
|
||||
msgstr "Écriture"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Partner"
|
||||
msgstr "Partenaire"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Partner Reference"
|
||||
msgstr "Réf. Partenaire"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Maturity Date"
|
||||
msgstr "Date d'échéance"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Debit"
|
||||
msgstr "Débit"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Credit"
|
||||
msgstr "Crédit"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Balance"
|
||||
msgstr "Solde"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Rec."
|
||||
msgstr "Let."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Part. Rec."
|
||||
msgstr "Let. Part."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT"
|
||||
msgstr "TVA"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT Amount"
|
||||
msgstr "Montant TVA"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Amount"
|
||||
msgstr "Montant"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Am. Currency"
|
||||
msgstr "Montant devise"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Curr."
|
||||
msgstr "Dev."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Document"
|
||||
msgstr "Document"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry Reference"
|
||||
msgstr "Écriture réf."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry Id"
|
||||
msgstr "Écriture id"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT Declaration"
|
||||
msgstr "Déclaration TVA"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Case"
|
||||
msgstr "Case"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Invoice"
|
||||
msgstr "Facture"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Voucher"
|
||||
msgstr "Voucher"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Statement"
|
||||
msgstr "Relevé"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Grouped Entries"
|
||||
msgstr "Écritures groupées"
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
# Dutch translation of OpenERP Server 6.1.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_journal_report_xls
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.1\n"
|
||||
"Report-Msgid-Bugs-To: support@noviat.be\n"
|
||||
"POT-Creation-Date: 2013-11-23 17:11:14.936000\n"
|
||||
"PO-Revision-Date: 2013-11-23 17:11:14.936000\n"
|
||||
"Last-Translator: Luc De Meyer (Noviat nv/sa)\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.actions.act_window,name:account_journal_report_xls.action_print_journal_by_period_xls
|
||||
msgid "Journal by Period"
|
||||
msgstr "Dagboekoverzicht per periode"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.actions.act_window,name:account_journal_report_xls.action_print_journal_by_fiscalyear_xls
|
||||
msgid "Journal by Fiscal Year"
|
||||
msgstr "Dagboekoverzicht per boekjaar"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.ui.menu,name:account_journal_report_xls.menu_print_journal_by_period_xls
|
||||
msgid "Journal by Period"
|
||||
msgstr "Dagboekoverzicht per periode"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: model:ir.ui.menu,name:account_journal_report_xls.menu_print_journal_by_fiscalyear_xls
|
||||
msgid "Journal by Fiscal Year"
|
||||
msgstr "Dagboekoverzicht per boekjaar"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,chart_account_id:0
|
||||
msgid "Chart of Account"
|
||||
msgstr "Rekeningschema"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,fiscalyear_id:0
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Boekjaar"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,target_move:0
|
||||
msgid "Target Moves"
|
||||
msgstr "Boekingen"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,target_move:0
|
||||
msgid "All Posted Entries"
|
||||
msgstr "Alle goedgekeurde boekingen"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,target_move:0
|
||||
msgid "All Entries"
|
||||
msgstr "Alle boekingen"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,sort_selection:0
|
||||
msgid "Entries Sorted by"
|
||||
msgstr "Boekingen gesorteerd op"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,sort_selection:0
|
||||
msgid "Journal Entry Number"
|
||||
msgstr "Nummer journaalpost"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: selection:account.print.journal.xls,sort_selection:0
|
||||
msgid "Date"
|
||||
msgstr "Datum"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,amount_currency:0
|
||||
msgid "With Currency"
|
||||
msgstr "Met valuta"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,group_entries:0
|
||||
msgid "Group Entries"
|
||||
msgstr "Groepeer dagboekregels"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,period_from:0
|
||||
msgid "Start Period"
|
||||
msgstr "Beginperiode"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: field:account.print.journal.xls,period_to:0
|
||||
msgid "End Period"
|
||||
msgstr "Eindperiode"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: code:addons/account_journal_report_xls/wizard/print_journal_wizard.py:10
|
||||
msgid "No records found for your selection!"
|
||||
msgstr "Geen records gevonden voor uw keuze!"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: code:addons/account_journal_report_xls/wizard/print_journal_wizard.py:11
|
||||
msgid "No Data Available"
|
||||
msgstr "Geen gegevens beschikbaar"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Period"
|
||||
msgstr "Periode"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Boekjaar"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Journal Overview"
|
||||
msgstr "Dagboekoverzicht"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry"
|
||||
msgstr "Boeking"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Date"
|
||||
msgstr "Datum"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Account"
|
||||
msgstr "Rekening"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Description"
|
||||
msgstr "Omschrijving"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Partner"
|
||||
msgstr "Partner"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Partner Reference"
|
||||
msgstr "Ref. Partner"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Maturity Date"
|
||||
msgstr "Vervaldatum"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Debit"
|
||||
msgstr "Debet"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Credit"
|
||||
msgstr "Credit"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Balance"
|
||||
msgstr "Saldo"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Rec."
|
||||
msgstr "Rec."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Part. Rec."
|
||||
msgstr "Rec. Part."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT"
|
||||
msgstr "BTW"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT Amount"
|
||||
msgstr "Bedrag BTW"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Amount"
|
||||
msgstr "Bedrag"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Currency"
|
||||
msgstr "Valuta"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Am. Currency"
|
||||
msgstr "Bedrag valuta"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Curr."
|
||||
msgstr "Val."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Document"
|
||||
msgstr "Document"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry Reference"
|
||||
msgstr "Boeking ref."
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Entry Id"
|
||||
msgstr "Boeking id"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "VAT Declaration"
|
||||
msgstr "BTW aangifte"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Case"
|
||||
msgstr "Vak"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Invoice"
|
||||
msgstr "Factuur"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Voucher"
|
||||
msgstr "Voucher"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Statement"
|
||||
msgstr "Uitreksel"
|
||||
|
||||
#. module: account_journal_report_xls
|
||||
#: report:nov.account.journal.print:0
|
||||
msgid "Grouped Entries"
|
||||
msgstr "Gegroepeerde boekingsregels"
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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 nov_account_journal
|
||||
import nov_account_journal_xls
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,291 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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 time
|
||||
from openerp.report import report_sxw
|
||||
from openerp.tools.translate import translate, _
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
_ir_translation_name = 'nov.account.journal.print'
|
||||
|
||||
|
||||
class nov_journal_print(report_sxw.rml_parse):
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
#_logger.warn('set_context, objects = %s, data = %s, ids = %s', objects, data, ids)
|
||||
super(nov_journal_print, self).set_context(objects, data, ids)
|
||||
j_obj = self.pool.get('account.journal')
|
||||
p_obj = self.pool.get('account.period')
|
||||
fy_obj = self.pool.get('account.fiscalyear')
|
||||
self.sort_selection = data['sort_selection']
|
||||
if data['target_move'] == 'posted':
|
||||
self.move_states = ['posted']
|
||||
else:
|
||||
self.move_states = ['draft', 'posted']
|
||||
self.display_currency = self.localcontext['display_currency'] = data['display_currency']
|
||||
self.group_entries = data['group_entries']
|
||||
self.print_by = data['print_by']
|
||||
self.report_type = report_type
|
||||
if self.print_by == 'period':
|
||||
journal_period_ids = data['journal_period_ids']
|
||||
objects = []
|
||||
for jp in journal_period_ids:
|
||||
journal = j_obj.browse(self.cr, self.uid, jp[0], self.context)
|
||||
periods = p_obj.browse(self.cr, self.uid, jp[1], self.context)
|
||||
objects.extend([(journal, period) for period in periods])
|
||||
self.localcontext['objects'] = self.objects = objects
|
||||
else:
|
||||
journal_fy_ids = data['journal_fy_ids']
|
||||
objects = []
|
||||
for jf in journal_fy_ids:
|
||||
journal = j_obj.browse(self.cr, self.uid, jf[0], self.context)
|
||||
fiscalyear = fy_obj.browse(self.cr, self.uid, jf[1], self.context)
|
||||
objects.append((journal, fiscalyear))
|
||||
self.localcontext['objects'] = self.objects = objects
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
if context is None:
|
||||
context = {}
|
||||
super(nov_journal_print, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'title': self._title,
|
||||
'amount_title': self._amount_title,
|
||||
'lines': self._lines,
|
||||
'sum1': self._sum1,
|
||||
'sum2': self._sum2,
|
||||
'tax_codes': self._tax_codes,
|
||||
'sum_vat': self._sum_vat,
|
||||
'_': 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 _title(self, object):
|
||||
return ((self.print_by == 'period' and self._('Period') or self._('Fiscal Year')) + ' ' + object[1].name, object[0].name)
|
||||
|
||||
def _amount_title(self):
|
||||
return self.display_currency and (self._('Amount'), self._('Currency')) or (self._('Debit'), self._('Credit'))
|
||||
|
||||
def _lines(self, object):
|
||||
j_obj = self.pool.get('account.journal')
|
||||
_ = self._
|
||||
journal = object[0]
|
||||
journal_id = journal.id
|
||||
if self.print_by == 'period':
|
||||
period = object[1]
|
||||
period_id = period.id
|
||||
period_ids = [period_id]
|
||||
# update status period
|
||||
ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid,
|
||||
[('journal_id', '=', journal_id), ('period_id', '=', period_id)])
|
||||
if ids_journal_period:
|
||||
self.cr.execute(
|
||||
'update account_journal_period set state=%s where journal_id=%s and period_id=%s and state=%s',
|
||||
('printed', journal_id, period_id, 'draft'))
|
||||
else:
|
||||
self.pool.get('account.journal.period').create(self.cr, self.uid, {
|
||||
'name': (journal.code or journal.name) + ':' + (period.name or ''),
|
||||
'journal_id': journal.id,
|
||||
'period_id': period.id,
|
||||
'state': 'printed',
|
||||
})
|
||||
_logger.error("The Entry for Period '%s', Journal '%s' was missing in 'account.journal.period' and has been fixed now !",
|
||||
period.name, journal.name)
|
||||
else:
|
||||
fiscalyear = object[1]
|
||||
period_ids = [x.id for x in fiscalyear.period_ids]
|
||||
|
||||
select_extra, join_extra, where_extra = j_obj._report_xls_query_extra(self.cr, self.uid, self.context)
|
||||
|
||||
self.cr.execute("SELECT l.move_id AS move_id, l.id AS aml_id, "
|
||||
"am.name AS move_name, coalesce(am.ref,'') AS move_ref, am.date AS move_date, "
|
||||
"aa.id AS account_id, aa.code AS acc_code, "
|
||||
"coalesce(rp.name,'') AS partner_name, coalesce(rp.ref,'') AS partner_ref, rp.id AS partner_id, "
|
||||
"coalesce(l.name,'') AS aml_name, "
|
||||
"l.date_maturity AS date_maturity, "
|
||||
"coalesce(ap.code, ap.name) AS period, "
|
||||
"coalesce(atc.code,'') AS tax_code, atc.id AS tax_code_id, coalesce(l.tax_amount,0.0) AS tax_amount, "
|
||||
"coalesce(l.debit,0.0) AS debit, coalesce(l.credit,0.0) AS credit, "
|
||||
"coalesce(amr.name,'') AS reconcile, coalesce(amrp.name,'') AS reconcile_partial, "
|
||||
"coalesce(l.amount_currency,0.0) AS amount_currency, "
|
||||
"rc.id AS currency_id, rc.name AS currency_name, rc.symbol AS currency_symbol, "
|
||||
"coalesce(ai.internal_number,'-') AS inv_number, coalesce(abs.name,'-') AS st_number, coalesce(av.number,'-') AS voucher_number "
|
||||
+ select_extra +
|
||||
"FROM account_move_line l "
|
||||
"INNER JOIN account_move am ON l.move_id = am.id "
|
||||
"INNER JOIN account_account aa ON l.account_id = aa.id "
|
||||
"INNER JOIN account_period ap ON l.period_id = ap.id "
|
||||
"LEFT OUTER JOIN account_invoice ai ON ai.move_id = am.id "
|
||||
"LEFT OUTER JOIN account_voucher av ON av.move_id = am.id "
|
||||
"LEFT OUTER JOIN account_bank_statement abs ON l.statement_id = abs.id "
|
||||
"LEFT OUTER JOIN res_partner rp ON l.partner_id = rp.id "
|
||||
"LEFT OUTER JOIN account_tax_code atc ON l.tax_code_id = atc.id "
|
||||
"LEFT OUTER JOIN account_move_reconcile amr ON l.reconcile_id = amr.id "
|
||||
"LEFT OUTER JOIN account_move_reconcile amrp ON l.reconcile_partial_id = amrp.id "
|
||||
"LEFT OUTER JOIN res_currency rc ON l.currency_id = rc.id "
|
||||
+ join_extra +
|
||||
"WHERE l.period_id IN %s AND l.journal_id = %s "
|
||||
"AND am.state IN %s "
|
||||
+ where_extra +
|
||||
"ORDER BY " + self.sort_selection + ", move_date, move_id, acc_code",
|
||||
(tuple(period_ids), journal_id, tuple(self.move_states)))
|
||||
lines = self.cr.dictfetchall()
|
||||
|
||||
# add reference of corresponding origin document
|
||||
if journal.type in ('sale', 'sale_refund', 'purchase', 'purchase_refund'):
|
||||
[x.update({'docname': (_('Invoice') + ': ' + x['inv_number']) or (_('Voucher') + ': ' + x['voucher_number']) or '-'}) for x in lines]
|
||||
elif journal.type in ('bank', 'cash'):
|
||||
[x.update({'docname': (_('Statement') + ': ' + x['st_number']) or (_('Voucher') + ': ' + x['voucher_number']) or '-'}) for x in lines]
|
||||
else:
|
||||
code_string = j_obj._report_xls_document_extra(self.cr, self.uid, self.context)
|
||||
#_logger.warn('code_string= %s', code_string)
|
||||
[x.update({'docname': eval(code_string) or '-'}) for x in lines]
|
||||
|
||||
# format debit, credit, amount_currency for pdf report
|
||||
if self.display_currency and self.report_type == 'pdf':
|
||||
curr_obj = self.pool.get('res.currency')
|
||||
[x.update({
|
||||
'amount1': self.formatLang(x['debit'] - x['credit']),
|
||||
'amount2': self.formatLang(x['amount_currency'], monetary=True, currency_obj=curr_obj.browse(self.cr, self.uid, x['currency_id'])),
|
||||
}) for x in lines]
|
||||
else:
|
||||
[x.update({'amount1': self.formatLang(x['debit']), 'amount2': self.formatLang(x['credit'])}) for x in lines]
|
||||
|
||||
# group lines
|
||||
if self.group_entries:
|
||||
lines = self._group_lines(lines)
|
||||
|
||||
# insert a flag in every move_line to indicate the end of a move
|
||||
# this flag will be used to draw a full line between moves
|
||||
for cnt in range(len(lines) - 1):
|
||||
if lines[cnt]['move_id'] != lines[cnt + 1]['move_id']:
|
||||
lines[cnt]['draw_line'] = 1
|
||||
else:
|
||||
lines[cnt]['draw_line'] = 0
|
||||
lines[-1]['draw_line'] = 1
|
||||
|
||||
return lines
|
||||
|
||||
def _group_lines(self, lines_in):
|
||||
|
||||
_ = self._
|
||||
|
||||
def group_move(lines_in):
|
||||
if len(lines_in) == 1:
|
||||
return lines_in
|
||||
lines_grouped = {}
|
||||
for line in lines_in:
|
||||
key = (line['account_id'], line['tax_code_id'], line['partner_id'])
|
||||
if not key in lines_grouped:
|
||||
lines_grouped[key] = line
|
||||
else:
|
||||
lines_grouped[key]['debit'] += line['debit']
|
||||
lines_grouped[key]['credit'] += line['credit']
|
||||
lines_grouped[key]['tax_amount'] += line['tax_amount']
|
||||
lines_grouped[key]['aml_name'] = _('Grouped Entries')
|
||||
lines_out = lines_grouped.values()
|
||||
lines_out.sort(key=lambda x: x['acc_code'])
|
||||
return lines_out
|
||||
|
||||
lines_out = []
|
||||
grouped_lines = [lines_in[0]]
|
||||
move_id = lines_in[0]['move_id']
|
||||
line_cnt = len(lines_in)
|
||||
for i in range(1,line_cnt):
|
||||
line = lines_in[i]
|
||||
if line['move_id'] == move_id:
|
||||
grouped_lines.append(line)
|
||||
if i == line_cnt - 1:
|
||||
lines_out += group_move(grouped_lines)
|
||||
else:
|
||||
lines_out += group_move(grouped_lines)
|
||||
grouped_lines = [line]
|
||||
move_id = line['move_id']
|
||||
|
||||
return lines_out
|
||||
|
||||
def _tax_codes(self, object):
|
||||
journal_id = object[0].id
|
||||
if self.print_by == 'period':
|
||||
period_id = object[1].id
|
||||
period_ids = [period_id]
|
||||
else:
|
||||
fiscalyear = object[1]
|
||||
period_ids = [x.id for x in fiscalyear.period_ids]
|
||||
self.cr.execute(
|
||||
"SELECT distinct tax_code_id FROM account_move_line l "
|
||||
"INNER JOIN account_move am ON l.move_id = am.id "
|
||||
"WHERE l.period_id in %s AND l.journal_id=%s AND l.tax_code_id IS NOT NULL AND am.state IN %s",
|
||||
(tuple(period_ids), journal_id, tuple(self.move_states)))
|
||||
ids = map(lambda x: x[0], self.cr.fetchall())
|
||||
if ids:
|
||||
self.cr.execute('SELECT id FROM account_tax_code WHERE id IN %s ORDER BY code', (tuple(ids),))
|
||||
tax_code_ids = map(lambda x: x[0], self.cr.fetchall())
|
||||
else:
|
||||
tax_code_ids = []
|
||||
tax_codes = self.pool.get('account.tax.code').browse(self.cr, self.uid, tax_code_ids, self.context)
|
||||
return tax_codes
|
||||
|
||||
def _totals(self, field, object, tax_code_id=None):
|
||||
journal_id = object[0].id
|
||||
if self.print_by == 'period':
|
||||
period_id = object[1].id
|
||||
period_ids = [period_id]
|
||||
else:
|
||||
fiscalyear = object[1]
|
||||
period_ids = [x.id for x in fiscalyear.period_ids]
|
||||
select = "SELECT sum(" + field + ") FROM account_move_line l " \
|
||||
"INNER JOIN account_move am ON l.move_id = am.id " \
|
||||
"WHERE l.period_id IN %s AND l.journal_id=%s AND am.state IN %s"
|
||||
if field == 'tax_amount':
|
||||
select += " AND tax_code_id=%s" % tax_code_id
|
||||
self.cr.execute(select, (tuple(period_ids), journal_id, tuple(self.move_states)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum1(self, object):
|
||||
return self._totals('debit', object)
|
||||
|
||||
def _sum2(self, object):
|
||||
if self.display_currency:
|
||||
return ''
|
||||
else:
|
||||
return self._totals('credit', object)
|
||||
|
||||
def _sum_vat(self, object, tax_code):
|
||||
return self._totals('tax_amount', object, tax_code.id)
|
||||
|
||||
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False):
|
||||
if isinstance(value, (float, int)) and not value:
|
||||
return ''
|
||||
else:
|
||||
return super(nov_journal_print, self).formatLang(value, digits, date, date_time, grouping, monetary, dp, currency_obj)
|
||||
|
||||
report_sxw.report_sxw('report.nov.account.journal.print', 'account.journal',
|
||||
'addons/account_journal_report_xls/report/nov_account_journal.rml',
|
||||
parser=nov_journal_print, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,286 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="28.0" y1="28.0" width="786" height="539"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table8">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table9">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table10">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table11">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
|
||||
<paraStyle name="P5" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text_20_body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table_20_Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table_20_Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Footer" fontName="Helvetica"/>
|
||||
<paraStyle name="Horizontal_20_Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
|
||||
<paraStyle name="terp_5f_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading_20_9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Bold_5f_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_General_5f_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_General_5f_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_Details_5f_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_tblheader_5f_Details_5f_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Right_5f_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Centre_5f_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_header_5f_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_header_5f_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Bold_5f_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Centre_5f_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Right_5f_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_5f_default_5f_Bold_5f_9_5f_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="page_5f_break" fontName="Helvetica" fontSize="8.0" leading="10"/>
|
||||
<paraStyle name="Heading_20_3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Hdr_5f_Right_5f_Underline" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_5f_default_5f_8">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<section>
|
||||
<pageBreak/>
|
||||
<para style="page_5f_break">[[ o!=objects[0] and ' ' or removeParentNode('section') ]]</para>
|
||||
</section>
|
||||
<blockTable colWidths="136.0,152.0,261.0,237.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P2">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ title(o)[0] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ title(o)[1] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Journal Overview [[ '- ' + company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="80.0,556.0,75.0,75.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<u>[[ formatLang(sum1(o)) ]]</u>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5">
|
||||
<u>[[ formatLang(sum2(o)) ]]</u>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="80.0,55.0,55.0,97.0,261.0,87.0,75.0,74.0" style="Table8">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Entry</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Account</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Partner</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">VAT</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ amount_title()[0] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">[[ amount_title()[1] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="P4">[[ repeatIn(lines(o), 'l') ]]</para>
|
||||
<blockTable colWidths="80.0,55.0,55.0,97.0,261.0,13.0,75.0,75.0,75.0" style="Table9">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id'])) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['move_date'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['acc_code'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['partner_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['aml_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ l['tax_code'] and (l['tax_code'] + ':') ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['tax_code'] and formatLang(l['tax_amount']) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_Right_5f_8">[[ l['amount1'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_Right_5f_8">[[ l['amount2'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="785.0" style="Table10">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[ l['draw_line'] and removeParentNode('blockTable') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="785.0" style="Table11">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[ not l['draw_line'] and removeParentNode('blockTable') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<para style="terp_5f_default_5f_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="785.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P8">VAT Declaration</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_5f_default_5f_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_5f_default_5f_8">[[ repeatIn(tax_codes(o), 't') ]] </para>
|
||||
<blockTable colWidths="31.0,83.0,22.0,650.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ t.code + ': ' ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_Right_5f_8">[[ formatLang(sum_vat(o,t)) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_5f_default_5f_8">[[ t.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
</section>
|
||||
</story>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,317 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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 xlwt
|
||||
import time
|
||||
from datetime import datetime
|
||||
from openerp.osv import orm
|
||||
from openerp.report import report_sxw
|
||||
from openerp.addons.report_xls.report_xls import report_xls
|
||||
from openerp.addons.report_xls.utils import rowcol_to_cell, _render
|
||||
from .nov_account_journal import nov_journal_print
|
||||
from openerp.tools.translate import _
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class account_journal_xls_parser(nov_journal_print):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_journal_xls_parser, self).__init__(cr, uid, name, context=context)
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
self.context = context
|
||||
wanted_list = journal_obj._report_xls_fields(cr, uid, context)
|
||||
template_changes = journal_obj._report_xls_template(cr, uid, context)
|
||||
self.localcontext.update({
|
||||
'datetime': datetime,
|
||||
'wanted_list': wanted_list,
|
||||
'template_changes': template_changes,
|
||||
})
|
||||
|
||||
|
||||
class account_journal_xls(report_xls):
|
||||
|
||||
def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
|
||||
super(account_journal_xls, self).__init__(name, table, rml, parser, header, store)
|
||||
|
||||
# Cell Styles
|
||||
_xs = self.xls_styles
|
||||
# header
|
||||
rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
|
||||
self.rh_cell_style = xlwt.easyxf(rh_cell_format)
|
||||
self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
|
||||
self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
|
||||
# lines
|
||||
aml_cell_format = _xs['borders_all']
|
||||
self.aml_cell_style = xlwt.easyxf(aml_cell_format)
|
||||
self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
|
||||
self.aml_cell_style_date = xlwt.easyxf(aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
|
||||
self.aml_cell_style_decimal = xlwt.easyxf(aml_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
|
||||
# totals
|
||||
rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
|
||||
self.rt_cell_style = xlwt.easyxf(rt_cell_format)
|
||||
self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
|
||||
self.rt_cell_style_decimal = xlwt.easyxf(rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
|
||||
|
||||
# XLS Template Journal Items
|
||||
self.col_specs_lines_template = {
|
||||
'move_name': {
|
||||
'header': [1, 20, 'text', _render("_('Entry')")],
|
||||
'lines': [1, 0, 'text', _render("l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'move_date': {
|
||||
'header': [1, 13, 'text', _render("_('Date')")],
|
||||
'lines': [1, 0, 'date', _render("datetime.strptime(l['move_date'],'%Y-%m-%d')"), None, self.aml_cell_style_date],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'acc_code': {
|
||||
'header': [1, 12, 'text', _render("_('Account')")],
|
||||
'lines': [1, 0, 'text', _render("l['acc_code']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'aml_name': {
|
||||
'header': [1, 42, 'text', _render("_('Description')")],
|
||||
'lines': [1, 0, 'text', _render("l['aml_name']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'period': {
|
||||
'header': [1, 12, 'text', _render("_('Period')")],
|
||||
'lines': [1, 0, 'text', _render("l['period']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'partner_name': {
|
||||
'header': [1, 36, 'text', _render("_('Partner')")],
|
||||
'lines': [1, 0, 'text', _render("l['partner_name']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'partner_ref': {
|
||||
'header': [1, 36, 'text', _render("_('Partner Reference')")],
|
||||
'lines': [1, 0, 'text', _render("l['partner_ref']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'date_maturity': {
|
||||
'header': [1, 13, 'text', _render("_('Maturity Date')")],
|
||||
'lines': [1, 0, _render("l['date_maturity'] and 'date' or 'text'"),
|
||||
_render("l['date_maturity'] and datetime.strptime(l['date_maturity'],'%Y-%m-%d') or None"),
|
||||
None, self.aml_cell_style_date],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'debit': {
|
||||
'header': [1, 18, 'text', _render("_('Debit')"), None, self.rh_cell_style_right],
|
||||
'lines': [1, 0, 'number', _render("l['debit']"), None, self.aml_cell_style_decimal],
|
||||
'totals': [1, 0, 'number', None, _render("debit_formula"), self.rt_cell_style_decimal]},
|
||||
'credit': {
|
||||
'header': [1, 18, 'text', _render("_('Credit')"), None, self.rh_cell_style_right],
|
||||
'lines': [1, 0, 'number', _render("l['credit']"), None, self.aml_cell_style_decimal],
|
||||
'totals': [1, 0, 'number', None, _render("credit_formula"), self.rt_cell_style_decimal]},
|
||||
'balance': {
|
||||
'header': [1, 18, 'text', _render("_('Balance')"), None, self.rh_cell_style_right],
|
||||
'lines': [1, 0, 'number', None, _render("bal_formula"), self.aml_cell_style_decimal],
|
||||
'totals': [1, 0, 'number', None, _render("bal_formula"), self.rt_cell_style_decimal]},
|
||||
'reconcile': {
|
||||
'header': [1, 12, 'text', _render("_('Rec.')"), None, self.rh_cell_style_center],
|
||||
'lines': [1, 0, 'text', _render("l['reconcile']"), None, self.aml_cell_style_center],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'reconcile_partial': {
|
||||
'header': [1, 12, 'text', _render("_('Part. Rec.')"), None, self.rh_cell_style_center],
|
||||
'lines': [1, 0, 'text', _render("l['reconcile_partial']"), None, self.aml_cell_style_center],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'tax_code': {
|
||||
'header': [1, 6, 'text', _render("_('VAT')"), None, self.rh_cell_style_center],
|
||||
'lines': [1, 0, 'text', _render("l['tax_code']"), None, self.aml_cell_style_center],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'tax_amount': {
|
||||
'header': [1, 18, 'text', _render("_('VAT Amount')"), None, self.rh_cell_style_right],
|
||||
'lines': [1, 0, 'number', _render("l['tax_amount']"), None, self.aml_cell_style_decimal],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'amount_currency': {
|
||||
'header': [1, 18, 'text', _render("_('Am. Currency')"), None, self.rh_cell_style_right],
|
||||
'lines': [1, 0, _render("l['amount_currency'] and 'number' or 'text'"),
|
||||
_render("l['amount_currency'] or None"),
|
||||
None, self.aml_cell_style_decimal],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'currency_name': {
|
||||
'header': [1, 6, 'text', _render("_('Curr.')"), None, self.rh_cell_style_center],
|
||||
'lines': [1, 0, 'text', _render("l['currency_name']"), None, self.aml_cell_style_center],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'docname': {
|
||||
'header': [1, 35, 'text', _render("_('Document')")],
|
||||
'lines': [1, 0, 'text', _render("l['docname']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'move_ref': {
|
||||
'header': [1, 25, 'text', _render("_('Entry Reference')")],
|
||||
'lines': [1, 0, 'text', _render("l['move_ref']")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
'move_id': {
|
||||
'header': [1, 10, 'text', _render("_('Entry Id')")],
|
||||
'lines': [1, 0, 'text', _render("str(l['move_id'])")],
|
||||
'totals': [1, 0, 'text', None]},
|
||||
}
|
||||
|
||||
# XLS Template VAT Summary
|
||||
self.col_specs_vat_summary_template = {
|
||||
'tax_case_name': {
|
||||
'header': [1, 45, 'text', _render("_('Description')")],
|
||||
'tax_totals': [1, 0, 'text', _render("t.name")]},
|
||||
'tax_code': {
|
||||
'header': [1, 6, 'text', _render("_('Case')")],
|
||||
'tax_totals': [1, 0, 'text', _render("t.code")]},
|
||||
'tax_amount': {
|
||||
'header': [1, 18, 'text', _render("_('Amount')"), None, self.rh_cell_style_right],
|
||||
'tax_totals': [1, 0, 'number', _render("sum_vat(o,t)"), None, self.aml_cell_style_decimal]},
|
||||
}
|
||||
|
||||
def _journal_title(self, o, ws, _p, row_pos, xlwt, _xs):
|
||||
cell_style = xlwt.easyxf(_xs['xls_title'])
|
||||
report_name = (10 * ' ').join([
|
||||
_p.company.name,
|
||||
_p.title(o)[0],
|
||||
_p.title(o)[1],
|
||||
_p._("Journal Overview") + ' - ' + _p.company.currency_id.name,
|
||||
])
|
||||
c_specs = [
|
||||
('report_name', 1, 0, 'text', report_name),
|
||||
]
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=cell_style)
|
||||
return row_pos + 1
|
||||
|
||||
def _journal_lines(self, o, ws, _p, row_pos, xlwt, _xs):
|
||||
|
||||
wanted_list = self.wanted_list
|
||||
debit_pos = self.debit_pos
|
||||
credit_pos = self.credit_pos
|
||||
|
||||
# Column headers
|
||||
c_specs = map(lambda x: self.render(x, self.col_specs_lines_template, 'header', render_space={'_': _p._}), wanted_list)
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=self.rh_cell_style, set_column_size=True)
|
||||
ws.set_horz_split_pos(row_pos)
|
||||
|
||||
# account move lines
|
||||
aml_start_pos = row_pos
|
||||
aml_cnt = len(_p.lines(o))
|
||||
cnt = 0
|
||||
for l in _p.lines(o):
|
||||
cnt += 1
|
||||
debit_cell = rowcol_to_cell(row_pos, debit_pos)
|
||||
credit_cell = rowcol_to_cell(row_pos, credit_pos)
|
||||
bal_formula = debit_cell + '-' + credit_cell
|
||||
c_specs = map(lambda x: self.render(x, self.col_specs_lines_template, 'lines'), wanted_list)
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=self.aml_cell_style)
|
||||
if l['draw_line'] and cnt != aml_cnt:
|
||||
row_pos += 1
|
||||
|
||||
# Totals
|
||||
debit_start = rowcol_to_cell(aml_start_pos, debit_pos)
|
||||
debit_stop = rowcol_to_cell(row_pos - 1, debit_pos)
|
||||
debit_formula = 'SUM(%s:%s)' % (debit_start, debit_stop)
|
||||
credit_start = rowcol_to_cell(aml_start_pos, credit_pos)
|
||||
credit_stop = rowcol_to_cell(row_pos - 1, credit_pos)
|
||||
credit_formula = 'SUM(%s:%s)' % (credit_start, credit_stop)
|
||||
debit_cell = rowcol_to_cell(row_pos, debit_pos)
|
||||
credit_cell = rowcol_to_cell(row_pos, credit_pos)
|
||||
bal_formula = debit_cell + '-' + credit_cell
|
||||
c_specs = map(lambda x: self.render(x, self.col_specs_lines_template, 'totals'), wanted_list)
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=self.rt_cell_style_right)
|
||||
return row_pos + 1
|
||||
|
||||
def _journal_vat_summary(self, o, ws, _p, row_pos, xlwt, _xs):
|
||||
|
||||
if not _p.tax_codes(o):
|
||||
return row_pos
|
||||
|
||||
title_cell_style = xlwt.easyxf(_xs['bold'])
|
||||
c_specs = [('summary_title', 1, 0, 'text', _p._("VAT Declaration"))]
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=title_cell_style) + 1
|
||||
|
||||
wanted_list = self.wanted_list
|
||||
vat_summary_wanted_list = ['tax_case_name', 'tax_code', 'tax_amount']
|
||||
|
||||
# calculate col_span
|
||||
cols_number = len(wanted_list)
|
||||
vat_summary_cols_number = len(vat_summary_wanted_list)
|
||||
if vat_summary_cols_number > cols_number:
|
||||
raise orm.except_orm(_('Programming Error!'),
|
||||
_("vat_summary_cols_number should be < cols_number !"))
|
||||
index = 0
|
||||
for i in range(vat_summary_cols_number):
|
||||
col = vat_summary_wanted_list[i]
|
||||
col_size = self.col_specs_lines_template[wanted_list[index]]['header'][1]
|
||||
templ_col_size = self.col_specs_vat_summary_template[col]['header'][1]
|
||||
#_logger.warn("col=%s, col_size=%s, templ_col_size=%s", col, col_size, templ_col_size)
|
||||
col_span = 1
|
||||
if templ_col_size > col_size:
|
||||
new_size = col_size
|
||||
while templ_col_size > new_size:
|
||||
col_span += 1
|
||||
index += 1
|
||||
new_size += self.col_specs_lines_template[wanted_list[index]]['header'][1]
|
||||
self.col_specs_vat_summary_template[col]['header'][0] = col_span
|
||||
self.col_specs_vat_summary_template[col]['tax_totals'][0] = col_span
|
||||
index += 1
|
||||
|
||||
c_specs = map(lambda x: self.render(x, self.col_specs_vat_summary_template, 'header'), vat_summary_wanted_list)
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=self.rh_cell_style)
|
||||
|
||||
for t in _p.tax_codes(o):
|
||||
c_specs = map(lambda x: self.render(x, self.col_specs_vat_summary_template, 'tax_totals'), vat_summary_wanted_list)
|
||||
row_data = self.xls_row_template(c_specs, [x[0] for x in c_specs])
|
||||
row_pos = self.xls_write_row(ws, row_pos, row_data, row_style=self.aml_cell_style)
|
||||
|
||||
return row_pos
|
||||
|
||||
def generate_xls_report(self, _p, _xs, data, objects, wb):
|
||||
|
||||
wanted_list = _p.wanted_list
|
||||
if _p.display_currency:
|
||||
wanted_list += ['amount_currency', 'currency_name']
|
||||
self.wanted_list = wanted_list
|
||||
self.col_specs_lines_template.update(_p.template_changes)
|
||||
|
||||
self.debit_pos = 'debit' in wanted_list and wanted_list.index('debit')
|
||||
self.credit_pos = 'credit' in wanted_list and wanted_list.index('credit')
|
||||
if not (self.credit_pos and self.debit_pos) and 'balance' in wanted_list:
|
||||
raise orm.except_orm(_('Customisation Error!'),
|
||||
_("The 'Balance' field is a calculated XLS field requiring the presence of the 'Debit' and 'Credit' fields !"))
|
||||
|
||||
for o in objects:
|
||||
|
||||
sheet_name = ' - '.join([o[1].code, o[0].code])[:31].replace('/', '-')
|
||||
sheet_name = sheet_name[:31].replace('/', '-')
|
||||
ws = wb.add_sheet(sheet_name)
|
||||
ws.panes_frozen = True
|
||||
ws.remove_splits = True
|
||||
ws.portrait = 0 # Landscape
|
||||
ws.fit_width_to_pages = 1
|
||||
row_pos = 0
|
||||
|
||||
# set print header/footer
|
||||
ws.header_str = self.xls_headers['standard']
|
||||
ws.footer_str = self.xls_footers['standard']
|
||||
|
||||
# Data
|
||||
row_pos = self._journal_title(o, ws, _p, row_pos, xlwt, _xs)
|
||||
row_pos = self._journal_lines(o, ws, _p, row_pos, xlwt, _xs)
|
||||
row_pos = self._journal_vat_summary(o, ws, _p, row_pos, xlwt, _xs)
|
||||
|
||||
account_journal_xls('report.nov.account.journal.xls', 'account.journal.period',
|
||||
parser=account_journal_xls_parser)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,25 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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 . import print_journal_wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,172 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
#
|
||||
# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved.
|
||||
#
|
||||
# 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.tools.translate import _
|
||||
from openerp.osv import orm, fields
|
||||
from openerp.addons.account.wizard.account_report_common_journal import account_common_journal_report
|
||||
import time
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class account_print_journal_xls(orm.TransientModel):
|
||||
_inherit = 'account.print.journal'
|
||||
_name = 'account.print.journal.xls'
|
||||
_description = 'Print/Export Journal'
|
||||
_columns = {
|
||||
'journal_ids': fields.many2many('account.journal', string='Journals', required=True),
|
||||
'group_entries': fields.boolean('Group Entries', help="Group entries with same General Account & Tax Code."),
|
||||
}
|
||||
_defaults = {
|
||||
'group_entries': True,
|
||||
}
|
||||
|
||||
def fields_get(self, cr, uid, fields=None, context=None):
|
||||
res = super(account_print_journal_xls, self).fields_get(cr, uid, fields, context)
|
||||
if context.get('print_by') == 'fiscalyear':
|
||||
if 'fiscalyear_id' in res:
|
||||
res['fiscalyear_id']['required'] = True
|
||||
if 'period_from' in res:
|
||||
res['period_from']['readonly'] = True
|
||||
if 'period_to' in res:
|
||||
res['period_to']['readonly'] = True
|
||||
else:
|
||||
if 'period_from' in res:
|
||||
res['period_from']['required'] = True
|
||||
if 'period_to' in res:
|
||||
res['period_to']['required'] = True
|
||||
return res
|
||||
|
||||
def fy_period_ids(self, cr, uid, fiscalyear_id):
|
||||
""" returns all periods from a fiscalyear sorted by date """
|
||||
fy_period_ids = []
|
||||
cr.execute('SELECT id, coalesce(special, False) AS special FROM account_period '
|
||||
'WHERE fiscalyear_id=%s ORDER BY date_start, special DESC',
|
||||
(fiscalyear_id,))
|
||||
res = cr.fetchall()
|
||||
if res:
|
||||
fy_period_ids = [x[0] for x in res]
|
||||
return fy_period_ids
|
||||
|
||||
def onchange_fiscalyear_id(self, cr, uid, ids, fiscalyear_id=False, context=None):
|
||||
res = {'value': {}}
|
||||
if context.get('print_by') == 'fiscalyear':
|
||||
# get period_from/to with opening/close periods
|
||||
fy_period_ids = self.fy_period_ids(cr, uid, fiscalyear_id)
|
||||
if fy_period_ids:
|
||||
res['value']['period_from'] = fy_period_ids[0]
|
||||
res['value']['period_to'] = fy_period_ids[-1]
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
""" skip account.common.journal.report,fields_view_get (adds domain filter on journal type) """
|
||||
return super(account_common_journal_report, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
|
||||
|
||||
def xls_export(self, cr, uid, ids, context=None):
|
||||
return self.print_report(cr, uid, ids, context=context)
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
move_obj = self.pool.get('account.move')
|
||||
print_by = context.get('print_by')
|
||||
wiz_form = self.browse(cr, uid, ids)[0]
|
||||
fiscalyear_id = wiz_form.fiscalyear_id.id
|
||||
company_id = wiz_form.company_id.id
|
||||
|
||||
if print_by == 'fiscalyear':
|
||||
wiz_period_ids = self.fy_period_ids(cr, uid, fiscalyear_id)
|
||||
else:
|
||||
period_from = wiz_form.period_from
|
||||
period_to = wiz_form.period_to
|
||||
cr.execute("SELECT id, coalesce(special, False) AS special FROM account_period ap "
|
||||
"WHERE ap.date_start>=%s AND ap.date_stop<=%s AND company_id=%s "
|
||||
"ORDER BY date_start, special DESC",
|
||||
(period_from.date_start, period_to.date_stop, company_id))
|
||||
wiz_period_ids = map(lambda x: x[0], cr.fetchall())
|
||||
wiz_journal_ids = [j.id for j in wiz_form.journal_ids]
|
||||
|
||||
# sort journals
|
||||
cr.execute('SELECT id FROM account_journal '
|
||||
'WHERE id IN %s ORDER BY type DESC',
|
||||
(tuple(wiz_journal_ids),))
|
||||
wiz_journal_ids = map(lambda x: x[0], cr.fetchall())
|
||||
|
||||
datas = {
|
||||
'model': 'account.journal',
|
||||
'print_by': print_by,
|
||||
'sort_selection': wiz_form.sort_selection,
|
||||
'target_move': wiz_form.target_move,
|
||||
'display_currency': wiz_form.amount_currency,
|
||||
'group_entries': wiz_form.group_entries,
|
||||
}
|
||||
|
||||
if wiz_form.target_move == 'posted':
|
||||
move_states = ['posted']
|
||||
else:
|
||||
move_states = ['draft', 'posted']
|
||||
|
||||
if print_by == 'fiscalyear':
|
||||
journal_fy_ids = []
|
||||
for journal_id in wiz_journal_ids:
|
||||
aml_ids = move_obj.search(cr, uid,
|
||||
[('journal_id', '=', journal_id), ('period_id', 'in', wiz_period_ids), ('state', 'in', move_states)],
|
||||
limit=1)
|
||||
if aml_ids:
|
||||
journal_fy_ids.append((journal_id, fiscalyear_id))
|
||||
if not journal_fy_ids:
|
||||
raise orm.except_orm(_('No Data Available'), _('No records found for your selection!'))
|
||||
datas.update({
|
||||
'ids': [x[0] for x in journal_fy_ids],
|
||||
'journal_fy_ids': journal_fy_ids,
|
||||
})
|
||||
else:
|
||||
# perform account.move.line query in stead of 'account.journal.period' since this table is not always reliable
|
||||
journal_period_ids = []
|
||||
for journal_id in wiz_journal_ids:
|
||||
period_ids = []
|
||||
for period_id in wiz_period_ids:
|
||||
aml_ids = move_obj.search(cr, uid,
|
||||
[('journal_id', '=', journal_id), ('period_id', '=', period_id), ('state', 'in', move_states)],
|
||||
limit=1)
|
||||
if aml_ids:
|
||||
period_ids.append(period_id)
|
||||
if period_ids:
|
||||
journal_period_ids.append((journal_id, period_ids))
|
||||
if not journal_period_ids:
|
||||
raise orm.except_orm(_('No Data Available'), _('No records found for your selection!'))
|
||||
datas.update({
|
||||
'ids': [x[0] for x in journal_period_ids],
|
||||
'journal_period_ids': journal_period_ids,
|
||||
})
|
||||
|
||||
if context.get('xls_export'):
|
||||
return {'type': 'ir.actions.report.xml',
|
||||
'report_name': 'nov.account.journal.xls',
|
||||
'datas': datas}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'nov.account.journal.print',
|
||||
'datas': datas}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_print_journal_xls" model="ir.ui.view">
|
||||
<field name="name">Print/Export Journals</field>
|
||||
<field name="model">account.print.journal.xls</field>
|
||||
<field name="inherit_id" ref="account.account_common_report_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<field name="fiscalyear_id" position="attributes">
|
||||
<attribute name="on_change">onchange_fiscalyear_id(fiscalyear_id, context)</attribute>
|
||||
</field>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Journals" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="This report allows you to generate a pdf or xls of your journals"/>
|
||||
</xpath>
|
||||
<xpath expr="//notebook" position="replace">
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='target_move']" position="after">
|
||||
<field name="sort_selection"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="group_entries"/>
|
||||
<newline/>
|
||||
<separator string="Periods" colspan="4"/>
|
||||
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" colspan="4"/>
|
||||
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" colspan="4"/>
|
||||
<separator string="Journals" colspan="4"/>
|
||||
<field name="journal_ids" colspan="4" nolabel="1"/>
|
||||
</xpath>
|
||||
<button string="Print" position="replace">
|
||||
<button icon="gtk-print" name="print_report" string="Print" type="object"/>
|
||||
<button icon="gtk-execute" name="xls_export" string="Export" type="object" class="oe_highlight" context="{'xls_export':1}"/>
|
||||
</button>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_print_journal_by_period_xls" model="ir.actions.act_window">
|
||||
<field name="name">Journal by Period</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.print.journal.xls</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="context">{'print_by':'period'}</field>
|
||||
<field name="view_id" ref="view_print_journal_xls"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Journal by Period"
|
||||
sequence="1"
|
||||
parent="account.menu_journals_report"
|
||||
action="action_print_journal_by_period_xls"
|
||||
id="menu_print_journal_by_period_xls"
|
||||
icon="STOCK_PRINT"/>
|
||||
|
||||
<record id="action_print_journal_by_fiscalyear_xls" model="ir.actions.act_window">
|
||||
<field name="name">Journal by Fiscal Year</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.print.journal.xls</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="context">{'print_by':'fiscalyear'}</field>
|
||||
<field name="view_id" ref="view_print_journal_xls"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Journal by Fiscal Year"
|
||||
sequence="2"
|
||||
parent="account.menu_journals_report"
|
||||
action="action_print_journal_by_fiscalyear_xls"
|
||||
id="menu_print_journal_by_fiscalyear_xls"
|
||||
icon="STOCK_PRINT"/>
|
||||
|
||||
<record id="account.menu_account_print_sale_purchase_journal" model="ir.ui.menu">
|
||||
<field name="sequence">3</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue