From 3499ea25a69b175caa47b21fd71e214731d7c7bd Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 19 Jan 2014 19:16:42 +0100 Subject: [PATCH] add fields to journal_report_xls --- account_journal_report_xls/__init__.py | 8 +-- account_journal_report_xls/__openerp__.py | 13 ++-- account_journal_report_xls/account_journal.py | 5 ++ account_journal_report_xls/i18n/fr.po | 59 ++++++++++++++++++- account_journal_report_xls/i18n/nl.po | 59 ++++++++++++++++++- .../report/nov_account_journal.py | 24 +++++--- .../report/nov_account_journal_xls.py | 20 +++++++ account_journal_report_xls/wizard/__init__.py | 6 +- .../wizard/print_journal_wizard.py | 6 +- 9 files changed, 169 insertions(+), 31 deletions(-) diff --git a/account_journal_report_xls/__init__.py b/account_journal_report_xls/__init__.py index d05eff46..1e73a062 100644 --- a/account_journal_report_xls/__init__.py +++ b/account_journal_report_xls/__init__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 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 @@ -12,11 +12,11 @@ # # 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 +# 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 . +# along with this program. If not, see . # ############################################################################## @@ -28,6 +28,4 @@ except ImportError: import logging logging.getLogger('openerp.module').warning('report_xls not available in addons path. account_financial_report_webkit_xls will not be usable') - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/account_journal_report_xls/__openerp__.py b/account_journal_report_xls/__openerp__.py index 6cd9f593..9f7cce5d 100644 --- a/account_journal_report_xls/__openerp__.py +++ b/account_journal_report_xls/__openerp__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 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 @@ -12,17 +12,17 @@ # # 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 +# 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 . +# along with this program. If not, see . # ############################################################################## { 'name': 'Financial Journal reports', - 'version': '0.1', + 'version': '0.2', 'license': 'AGPL-3', 'author': 'Noviat', 'category': 'Accounting & Finance', @@ -47,9 +47,8 @@ cf. https://launchpad.net/openerp-reporting-engines 'account_voucher', 'report_xls', ], - 'demo_xml': [], - 'init_xml': [], - 'update_xml': [ + 'demo': [], + 'data': [ 'wizard/print_journal_wizard.xml', ], } diff --git a/account_journal_report_xls/account_journal.py b/account_journal_report_xls/account_journal.py index c1e3dbcf..9c24a711 100644 --- a/account_journal_report_xls/account_journal.py +++ b/account_journal_report_xls/account_journal.py @@ -65,6 +65,11 @@ class account_journal(orm.Model): #'partner_ref', # res.partner,ref #'move_ref', # account.move,ref #'move_id', # account.move,id + #'acc_name', # account.account,name + #'journal', # account.journal,name + #'journal_code', # account.journal,code + #'analytic_account', # account.analytic.account,name + #'analytic_account_code', # account.analytic.account,code ] return res diff --git a/account_journal_report_xls/i18n/fr.po b/account_journal_report_xls/i18n/fr.po index eec93f28..f01ca711 100644 --- a/account_journal_report_xls/i18n/fr.po +++ b/account_journal_report_xls/i18n/fr.po @@ -6,8 +6,8 @@ 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" +"POT-Creation-Date: 2014-01-19 17:16:37.990000\n" +"PO-Revision-Date: 2014-01-19 17:16:37.990000\n" "Last-Translator: Luc De Meyer (Noviat nv/sa)\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -119,11 +119,36 @@ msgstr "Exercice fiscal" msgid "Journal Overview" msgstr "Journal détaillé" +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Journal Items" +msgstr "Écritures comptables" + #. 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 "Name" +msgstr "Nom" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Reference" +msgstr "Référence" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Effective Date" +msgstr "Date" + +#. 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 "Date" @@ -134,6 +159,16 @@ msgstr "Date" msgid "Account" msgstr "Compte" +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Account Name" +msgstr "Description compte " + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Journal" +msgstr "Journal" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "Description" @@ -179,6 +214,16 @@ msgstr "Let." msgid "Part. Rec." msgstr "Let. Part." +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Tax Code" +msgstr "Case TVA" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Tax/Base Amount" +msgstr "Montant TVA/Base" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "VAT" @@ -209,6 +254,16 @@ msgstr "Montant devise" msgid "Curr." msgstr "Dev." +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Comp. Curr." +msgstr "Dev. Soc." + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Analytic Account" +msgstr "Compte analytique" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "Document" diff --git a/account_journal_report_xls/i18n/nl.po b/account_journal_report_xls/i18n/nl.po index 502febcf..e9ace14a 100644 --- a/account_journal_report_xls/i18n/nl.po +++ b/account_journal_report_xls/i18n/nl.po @@ -6,8 +6,8 @@ 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" +"POT-Creation-Date: 2014-01-19 17:16:37.980000\n" +"PO-Revision-Date: 2014-01-19 17:16:37.980000\n" "Last-Translator: Luc De Meyer (Noviat nv/sa)\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -119,11 +119,36 @@ msgstr "Boekjaar" msgid "Journal Overview" msgstr "Dagboekoverzicht" +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Journal Items" +msgstr "Boekingsregels" + #. 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 "Name" +msgstr "Naam" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Reference" +msgstr "Referentie" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Effective Date" +msgstr "Datum" + +#. 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 "Date" @@ -134,6 +159,16 @@ msgstr "Datum" msgid "Account" msgstr "Rekening" +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Account Name" +msgstr "Omschrijving rekening" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Journal" +msgstr "Dagboek" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "Description" @@ -179,6 +214,16 @@ msgstr "Rec." msgid "Part. Rec." msgstr "Rec. Part." +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Tax Code" +msgstr "BTW vak" + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Tax/Base Amount" +msgstr "Bedrag BTW/Mvh" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "VAT" @@ -209,6 +254,16 @@ msgstr "Bedrag valuta" msgid "Curr." msgstr "Val." +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Comp. Curr." +msgstr "Bedr. Val." + +#. module: account_journal_report_xls +#: report:nov.account.journal.print:0 +msgid "Analytic Account" +msgstr "Kostenplaats" + #. module: account_journal_report_xls #: report:nov.account.journal.print:0 msgid "Document" diff --git a/account_journal_report_xls/report/nov_account_journal.py b/account_journal_report_xls/report/nov_account_journal.py index d46fb5d4..3e7dda9b 100644 --- a/account_journal_report_xls/report/nov_account_journal.py +++ b/account_journal_report_xls/report/nov_account_journal.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 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 @@ -12,11 +12,11 @@ # # 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 +# 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 . +# along with this program. If not, see . # ############################################################################## @@ -121,9 +121,12 @@ class nov_journal_print(report_sxw.rml_parse): select_extra, join_extra, where_extra = j_obj._report_xls_query_extra(self.cr, self.uid, self.context) + # SQL select for performance reasons, as a consequence, there are no field value translations. + # If performance is no issue, you can adapt the _report_xls_template in an inherited module to add field value translations. 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, " + "aa.id AS account_id, aa.code AS acc_code, aa.name AS acc_name, " + "aj.name AS journal, aj.code AS journal_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, " @@ -131,6 +134,7 @@ class nov_journal_print(report_sxw.rml_parse): "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, " + "ana.name AS an_acc_name, coalesce(ana.code,'') AS an_acc_code, " "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 " @@ -138,6 +142,7 @@ class nov_journal_print(report_sxw.rml_parse): "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_journal aj ON l.journal_id = aj.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 " @@ -146,6 +151,7 @@ class nov_journal_print(report_sxw.rml_parse): "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 account_analytic_account ana ON l.analytic_account_id = ana.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 " @@ -165,6 +171,10 @@ class nov_journal_print(report_sxw.rml_parse): #_logger.warn('code_string= %s', code_string) [x.update({'docname': eval(code_string) or '-'}) for x in lines] + # group lines + if self.group_entries: + lines = self._group_lines(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') @@ -175,10 +185,6 @@ class nov_journal_print(report_sxw.rml_parse): 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): @@ -215,7 +221,7 @@ class nov_journal_print(report_sxw.rml_parse): grouped_lines = [lines_in[0]] move_id = lines_in[0]['move_id'] line_cnt = len(lines_in) - for i in range(1,line_cnt): + for i in range(1, line_cnt): line = lines_in[i] if line['move_id'] == move_id: grouped_lines.append(line) diff --git a/account_journal_report_xls/report/nov_account_journal_xls.py b/account_journal_report_xls/report/nov_account_journal_xls.py index 34229a43..00476b19 100644 --- a/account_journal_report_xls/report/nov_account_journal_xls.py +++ b/account_journal_report_xls/report/nov_account_journal_xls.py @@ -86,6 +86,10 @@ class account_journal_xls(report_xls): 'header': [1, 12, 'text', _render("_('Account')")], 'lines': [1, 0, 'text', _render("l['acc_code']")], 'totals': [1, 0, 'text', None]}, + 'acc_name': { + 'header': [1, 36, 'text', _render("_('Account Name')")], + 'lines': [1, 0, 'text', _render("l['acc_name']")], + 'totals': [1, 0, 'text', None]}, 'aml_name': { 'header': [1, 42, 'text', _render("_('Description')")], 'lines': [1, 0, 'text', _render("l['aml_name']")], @@ -94,6 +98,22 @@ class account_journal_xls(report_xls): 'header': [1, 12, 'text', _render("_('Period')")], 'lines': [1, 0, 'text', _render("l['period']")], 'totals': [1, 0, 'text', None]}, + 'journal': { + 'header': [1, 20, 'text', _render("_('Journal')")], + 'lines': [1, 0, 'text', _render("l['journal']")], + 'totals': [1, 0, 'text', None]}, + 'journal_code': { + 'header': [1, 10, 'text', _render("_('Journal')")], + 'lines': [1, 0, 'text', _render("l['journal_code']")], + 'totals': [1, 0, 'text', None]}, + 'analytic_account': { + 'header': [1, 20, 'text', _render("_('Analytic Account')")], + 'lines': [1, 0, 'text', _render("l['an_acc_name']")], + 'totals': [1, 0, 'text', None]}, + 'analytic_account_code': { + 'header': [1, 20, 'text', _render("_('Analytic Account')")], + 'lines': [1, 0, 'text', _render("l['an_acc_code']")], + 'totals': [1, 0, 'text', None]}, 'partner_name': { 'header': [1, 36, 'text', _render("_('Partner')")], 'lines': [1, 0, 'text', _render("l['partner_name']")], diff --git a/account_journal_report_xls/wizard/__init__.py b/account_journal_report_xls/wizard/__init__.py index 154d6a6e..2e90d13a 100644 --- a/account_journal_report_xls/wizard/__init__.py +++ b/account_journal_report_xls/wizard/__init__.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 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 @@ -12,11 +12,11 @@ # # 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 +# 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 . +# along with this program. If not, see . # ############################################################################## diff --git a/account_journal_report_xls/wizard/print_journal_wizard.py b/account_journal_report_xls/wizard/print_journal_wizard.py index 75216164..292d2e7a 100644 --- a/account_journal_report_xls/wizard/print_journal_wizard.py +++ b/account_journal_report_xls/wizard/print_journal_wizard.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # -# Copyright (c) 2013 Noviat nv/sa (www.noviat.com). All rights reserved. +# Copyright (c) 2014 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 @@ -12,11 +12,11 @@ # # 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 +# 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 . +# along with this program. If not, see . # ##############################################################################