openobject-italia-core-devs team mailing list archive
-
openobject-italia-core-devs team
-
Mailing list archive
-
Message #01113
[Merge] lp:~enlightx/openobject-italia/adding_l10n_it_prima_nota_cassa into lp:openobject-italia/7.0
Davide Corio - agilebg.com has proposed merging lp:~enlightx/openobject-italia/adding_l10n_it_prima_nota_cassa into lp:openobject-italia/7.0.
Requested reviews:
OpenERP Italia core devs (openobject-italia-core-devs)
For more details, see:
https://code.launchpad.net/~enlightx/openobject-italia/adding_l10n_it_prima_nota_cassa/+merge/147941
--
https://code.launchpad.net/~enlightx/openobject-italia/adding_l10n_it_prima_nota_cassa/+merge/147941
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~enlightx/openobject-italia/adding_l10n_it_prima_nota_cassa into lp:openobject-italia/7.0.
=== added directory 'l10n_it_prima_nota_cassa'
=== added file 'l10n_it_prima_nota_cassa/AUTHORS.txt'
--- l10n_it_prima_nota_cassa/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/AUTHORS.txt 2013-02-12 14:33:27 +0000
@@ -0,0 +1,2 @@
+Leonardo Pistone <leonardo.pistone@xxxxxxxxxxxx>
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxxx>
=== added file 'l10n_it_prima_nota_cassa/README.txt'
--- l10n_it_prima_nota_cassa/README.txt 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/README.txt 2013-02-12 14:33:27 +0000
@@ -0,0 +1,5 @@
+Questo modulo usa report_webkit.
+E' necessario installare wkhtmltopdf per la stampa dei reports.
+
+La versione inclusa in Ubuntu necessità di alcune patch, quindi è più agevole scaricare l'eseguibile binario dal sito del progetto:
+http://code.google.com/p/wkhtmltopdf/
=== added file 'l10n_it_prima_nota_cassa/__init__.py'
--- l10n_it_prima_nota_cassa/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/__init__.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2011-2012 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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 report
+import wizard
=== added file 'l10n_it_prima_nota_cassa/__openerp__.py'
--- l10n_it_prima_nota_cassa/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/__openerp__.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2011-2013 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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': 'Italian Localisation - Prima Nota Cassa',
+ 'version': '0.1',
+ 'category': 'Localisation/Italy',
+ 'description': """Accounting reports - Prima Nota Cassa - Webkit""",
+ 'author': 'OpenERP Italian Community',
+ 'website': 'http://www.openerp-italia.org',
+ 'license': 'AGPL-3',
+ "depends" : ['account', 'report_webkit'],
+ "init_xml" : [
+ ],
+ "update_xml" : [
+ 'reports.xml',
+ 'wizard/wizard_print_prima_nota_cassa.xml',
+ ],
+ "demo_xml" : [],
+ "active": False,
+ "installable": True
+}
=== added directory 'l10n_it_prima_nota_cassa/i18n'
=== added file 'l10n_it_prima_nota_cassa/i18n/it.po'
--- l10n_it_prima_nota_cassa/i18n/it.po 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/i18n/it.po 2013-02-12 14:33:27 +0000
@@ -0,0 +1,211 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * l10n_it_prima_nota_cassa
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-02-12 09:09+0000\n"
+"PO-Revision-Date: 2013-02-12 10:16+0100\n"
+"Last-Translator: Davide Corio <davide.corio@xxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:8
+msgid "Prime entry"
+msgstr "Prima Nota"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,filter:0
+msgid "No Filters"
+msgstr "Nessun Filtro"
+
+#. module: l10n_it_prima_nota_cassa
+#: view:account.report.prima_nota_cassa:0
+msgid "This report prints a summary of all cash and bank moves in a given date or period range. It is possible to restrict analysis to single cash or bank accounts on the second tab."
+msgstr "Questo report stampa un sommario di tutti i movimenti di cassa e banca in un dato periodo o data. E' possibile restringere l'analisi ad un singolo conto bancario o cassa usando il secondo tab."
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:43
+#: code:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.py:38
+#, python-format
+msgid "Debit"
+msgstr "Debito"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:16
+msgid "Filter By"
+msgstr "Filtra Per"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:42
+msgid "Entry"
+msgstr "Registrazione"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:40
+msgid "Ref"
+msgstr "Rif"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,company_id:0
+msgid "Company"
+msgstr "Azienda"
+
+#. module: l10n_it_prima_nota_cassa
+#: model:ir.model,name:l10n_it_prima_nota_cassa.model_account_report_prima_nota_cassa
+msgid "Print Prima Nota Cassa"
+msgstr "Stampa Prima Nota"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,initial_balance:0
+msgid "Include initial balances"
+msgstr "Includi saldi iniziali"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,display_account:0
+msgid "With balance is not equal to 0"
+msgstr "Con saldo diverso da 0"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:15
+msgid "Jounal"
+msgstr "Sezionale"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,filter:0
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:37
+msgid "Date"
+msgstr "Data"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,chart_account_id:0
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:13
+msgid "Chart of Account"
+msgstr "Piano dei Conti"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,journal_ids:0
+msgid "Journals"
+msgstr "Sezionali"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,target_move:0
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:17
+msgid "Target Moves"
+msgstr "Movimenti"
+
+#. module: l10n_it_prima_nota_cassa
+#: help:account.report.prima_nota_cassa,chart_account_id:0
+msgid "Select Charts of Accounts"
+msgstr "Seleziona Piano dei Conti"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,date_to:0
+msgid "End Date"
+msgstr "Data Fine"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,period_from:0
+msgid "Start Period"
+msgstr "Periodo Iniziale"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,target_move:0
+msgid "All Posted Entries"
+msgstr "Tutti i movimenti confermati"
+
+#. module: l10n_it_prima_nota_cassa
+#: help:account.report.prima_nota_cassa,fiscalyear_id:0
+msgid "Keep empty for all open fiscal year"
+msgstr "Lasciare vuoto per tutti gli anni fiscali aperti"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,period_to:0
+msgid "End Period"
+msgstr "Periodo Finale"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:44
+msgid "Credit"
+msgstr "Credito"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,fiscalyear_id:0
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:14
+msgid "Fiscal Year"
+msgstr "Anno Fiscale"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,display_account:0
+msgid "Display Accounts"
+msgstr "Mostra Conti"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:45
+msgid "Balance"
+msgstr "Saldo"
+
+#. module: l10n_it_prima_nota_cassa
+#: view:account.report.prima_nota_cassa:0
+#: model:ir.actions.act_window,name:l10n_it_prima_nota_cassa.action_account_prima_nota_cassa
+#: model:ir.actions.report.xml,name:l10n_it_prima_nota_cassa.prima_nota_cassa
+#: model:ir.ui.menu,name:l10n_it_prima_nota_cassa.menu_print_prima_nota_cassa
+msgid "Prima Nota Cassa"
+msgstr "Prima Nota Cassa"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,display_account:0
+msgid "With movements"
+msgstr "Con movimenti"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,display_account:0
+msgid "All"
+msgstr "Tutti"
+
+#. module: l10n_it_prima_nota_cassa
+#: help:account.report.prima_nota_cassa,initial_balance:0
+msgid "It adds initial balance row on report which display previous sum amount of debit/credit/balance"
+msgstr "Aggiunge una riga per il saldo iniziale sul report, che mostrerà la somma precedente per debiti/crediti/saldo"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:41
+msgid "Move"
+msgstr "Movimento"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,filter:0
+msgid "Periods"
+msgstr "Periodi"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:38
+msgid "JRNL"
+msgstr "Sezionale"
+
+#. module: l10n_it_prima_nota_cassa
+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:39
+msgid "Partner"
+msgstr "Partner"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,date_from:0
+msgid "Start Date"
+msgstr "Data Inizio"
+
+#. module: l10n_it_prima_nota_cassa
+#: field:account.report.prima_nota_cassa,filter:0
+msgid "Filter by"
+msgstr "Filtra per"
+
+#. module: l10n_it_prima_nota_cassa
+#: selection:account.report.prima_nota_cassa,target_move:0
+msgid "All Entries"
+msgstr "Tutti i movimenti"
+
=== added directory 'l10n_it_prima_nota_cassa/report'
=== added file 'l10n_it_prima_nota_cassa/report/__init__.py'
--- l10n_it_prima_nota_cassa/report/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/report/__init__.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2011-2012 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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 prima_nota_cassa
=== added file 'l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako'
--- l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako 2013-02-12 14:33:27 +0000
@@ -0,0 +1,63 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ <h1 class="title">${_("Prime entry")} </h1>
+
+ <table class="basic_table" width="90%">
+ <tr>
+ <td>${ _("Chart of Account") }</td>
+ <td>${ _("Fiscal Year") }</td>
+ <td>${ _("Jounal")}</td>
+ <td>${ _("Filter By") }</td>
+ <td>${ _("Target Moves") }</td>
+ </tr>
+ <tr>
+
+ <td>${ get_account(data) or '' }</td>
+ <td>${ get_fiscalyear(data) or '' }</td>
+ <td>${ ', '.join([ lt or '' for lt in get_journal(data)]) }</td>
+ <td>${ get_filter(data) or '' }</td>
+ <td>${ get_target_move(data) }</td>
+ </tr>
+ </table>
+
+ <br />
+
+ <div id="results">
+ % for a in objects:
+ <% setLang(company.partner_id.lang) %>
+ <table class="list_table" width="90%">
+ <tr>
+ <th> ${ _('Date') }</th>
+ <th> ${ _('Journal') }</th>
+ <th> ${ _('Partner') }</th>
+ <th> ${ _('Entry') }</th>
+ <th> ${ _('Description') }</th>
+ <th> ${ _('Debit') }</th>
+ <th> ${ _('Credit') }</th>
+ <th> ${ _('Balance') }</th>
+ </tr>
+
+
+ %for line in lines(a) :
+ <tr style="page-break-inside: avoid; vertical-align:text-top;">
+ <td>${ formatLang(line['ldate'], date=True) or ''|entity }</td>
+ <td>${ line['jname'] or ''|entity }</td>
+ <td>${ line['partner_name'] or ''|entity }</td>
+ <td>${ line['move'] or ''|entity }</td>
+ <td>${ line['lname'] or ''|entity }</td>
+ <td>${ formatLang(line['debit'], digits=get_digits(dp='Account')) |entity}</td>
+ <td>${ formatLang(line['credit'], digits=get_digits(dp='Account')) |entity}</td>
+ <td>${ line['debit'] - line['credit'] |entity}</td>
+ </tr>
+ %endfor
+ </table>
+ %endfor
+
+ </div>
+ </body>
+</html>
=== added file 'l10n_it_prima_nota_cassa/report/prima_nota_cassa.py'
--- l10n_it_prima_nota_cassa/report/prima_nota_cassa.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/report/prima_nota_cassa.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,307 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+# Copyright (C) 2011-2012 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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 report import report_sxw
+from account.report.common_report_header import common_report_header
+from tools.translate import _
+
+class print_prima_nota_cassa(report_sxw.rml_parse, common_report_header):
+ _name = 'report.account.prima_nota_cassa'
+
+ def set_context(self, objects, data, ids, report_type=None):
+ new_ids = ids
+ obj_move = self.pool.get('account.move.line')
+ self.sortby = data['form'].get('sortby', 'sort_date')
+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{}))
+ ctx2 = data['form'].get('used_context',{}).copy()
+ print _('Debit')
+ self.init_balance = data['form']['initial_balance']
+ self.display_account = data['form']['display_account']
+ self.target_move = data['form'].get('target_move', 'all')
+ self.journal_ids = data['form'].get('journal_ids', [])
+ ctx = self.context.copy()
+ ctx['fiscalyear'] = data['form']['fiscalyear_id']
+ if data['form']['filter'] == 'filter_period':
+ ctx['periods'] = data['form']['periods']
+ elif data['form']['filter'] == 'filter_date':
+ ctx['date_from'] = data['form']['date_from']
+ ctx['date_to'] = data['form']['date_to']
+ ctx['state'] = data['form']['target_move']
+ self.context.update(ctx)
+ if (data['model'] == 'ir.ui.menu'):
+ new_ids = [data['form']['chart_account_id']]
+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
+ return super(print_prima_nota_cassa, self).set_context(objects, data, new_ids, report_type=report_type)
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(print_prima_nota_cassa, self).__init__(cr, uid, name, context=context)
+ self.query = ""
+ self.tot_currency = 0.0
+ self.period_sql = ""
+ self.sold_accounts = {}
+ self.sortby = 'sort_date'
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit_account': self._sum_debit_account,
+ 'sum_credit_account': self._sum_credit_account,
+ 'sum_balance_account': self._sum_balance_account,
+ 'sum_currency_amount_account': self._sum_currency_amount_account,
+# 'get_children_accounts': self.get_children_accounts,
+ 'get_fiscalyear': self._get_fiscalyear,
+ 'get_journal': self._get_journal,
+ 'get_account': self._get_account,
+ 'get_start_period': self.get_start_period,
+ 'get_end_period': self.get_end_period,
+ 'get_filter': self._get_filter,
+ 'get_sortby': self._get_sortby,
+ 'get_start_date':self._get_start_date,
+ 'get_end_date':self._get_end_date,
+ 'get_target_move': self._get_target_move,
+ 'ipdb': self.ipdb
+ })
+ self.context = context
+
+ def ipdb(self, data):
+ import ipdb;ipdb.set_trace()
+ return 'LEP WAS HERE'
+
+ def _sum_currency_amount_account(self, account):
+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
+ FROM account_move_line l \
+ WHERE l.account_id = %s AND %s' %(account.id, self.query))
+ sum_currency = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
+ FROM account_move_line l \
+ WHERE l.account_id = %s AND %s '%(account.id, self.init_query))
+ sum_currency += self.cr.fetchone()[0] or 0.0
+ return sum_currency
+
+ def get_children_accounts(self, account):
+ """ Return all the accounts that are children of the chosen main one
+ and are set as default for the selected cash and bank accounts"""
+
+ currency_obj = self.pool.get('res.currency')
+ journal_obj = self.pool.get('account.journal')
+
+ cash_bank_journals = journal_obj.search(self.cr, self.uid, [ ('type','in',('bank','cash')) ] )
+
+ cash_bank_accounts = [journal_obj.browse(self.cr, self.uid, j).default_credit_account_id.id for j in cash_bank_journals] + \
+ [journal_obj.browse(self.cr, self.uid, j).default_debit_account_id.id for j in cash_bank_journals]
+
+ ids_acc = [acc for acc in self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id) \
+ if acc in cash_bank_accounts]
+
+ currency = account.currency_id and account.currency_id or account.company_id.currency_id
+
+ return ids_acc
+
+ def lines(self, main_account):
+ """ Return all the account_move_line of account with their account code counterparts """
+ #import ipdb;ipdb.set_trace()
+ account_ids = self.get_children_accounts(main_account)
+
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted', '']
+
+ # Then select all account_move_line of this account
+ if self.sortby == 'sort_journal_partner':
+ sql_sort='j.code, p.name, l.move_id'
+ else:
+ sql_sort='l.date, l.move_id'
+ sql = """
+ SELECT
+ l.id AS lid,
+ l.date AS ldate,
+ j.code AS lcode,
+ j.name AS jname,
+ l.currency_id,
+ l.amount_currency,
+ l.ref AS lref,
+ l.name AS lname,
+ COALESCE(l.debit,0) AS debit,
+ COALESCE(l.credit,0) AS credit,
+ l.period_id AS lperiod_id,
+ l.partner_id AS lpartner_id,
+ m.name AS move_name,
+ m.id AS mmove_id,
+ per.code as period_code,
+ c.symbol AS currency_code,
+ i.id AS invoice_id,
+ i.type AS invoice_type,
+ i.number AS invoice_number,
+ p.name AS partner_name
+ FROM account_move_line l
+ JOIN account_move m on (l.move_id=m.id)
+ LEFT JOIN res_currency c on (l.currency_id=c.id)
+ LEFT JOIN res_partner p on (l.partner_id=p.id)
+ LEFT JOIN account_invoice i on (m.id =i.move_id)
+ LEFT JOIN account_period per on (per.id=l.period_id)
+ JOIN account_journal j on (l.journal_id=j.id)
+ WHERE %s
+ AND m.state IN %s
+ AND l.account_id in %%s
+ ORDER by %s
+ """ %(self.query, tuple(move_state), sql_sort)
+ self.cr.execute(sql, (tuple(account_ids),))
+ res = self.cr.dictfetchall()
+ for l in res:
+ l['move'] = l['move_name'] != '/' and l['move_name'] or ('*'+str(l['mmove_id']))
+ l['partner'] = l['partner_name'] or ''
+ # Modification of amount Currency
+ if l['credit'] > 0:
+ if l['amount_currency'] != None:
+ l['amount_currency'] = abs(l['amount_currency']) * -1
+ if l['amount_currency'] != None:
+ self.tot_currency = self.tot_currency + l['amount_currency']
+ return res
+
+ def _sum_total_debit(self, account):
+ move_state = ['draft','posted']
+
+ account_ids = self.get_children_accounts(main_account)
+
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_debit = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_debit += self.cr.fetchone()[0] or 0.0
+ return sum_debit
+
+ def _sum_debit_account(self, account):
+ if account.type == 'view':
+ return account.debit
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_debit = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(debit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_debit += self.cr.fetchone()[0] or 0.0
+ return sum_debit
+
+ def _sum_credit_account(self, account):
+ if account.type == 'view':
+ return account.credit
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT sum(credit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_credit = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT sum(credit) \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_credit += self.cr.fetchone()[0] or 0.0
+ return sum_credit
+
+ def _sum_balance_account(self, account):
+ if account.type == 'view':
+ return account.balance
+ move_state = ['draft','posted']
+ if self.target_move == 'posted':
+ move_state = ['posted','']
+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.query +' '
+ ,(account.id, tuple(move_state)))
+ sum_balance = self.cr.fetchone()[0] or 0.0
+ if self.init_balance:
+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
+ FROM account_move_line l \
+ JOIN account_move am ON (am.id = l.move_id) \
+ WHERE (l.account_id = %s) \
+ AND (am.state IN %s) \
+ AND '+ self.init_query +' '
+ ,(account.id, tuple(move_state)))
+ # Add initial balance to the result
+ sum_balance += self.cr.fetchone()[0] or 0.0
+ return sum_balance
+
+ def _get_account(self, data):
+ if data['model'] == 'account.account':
+ return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
+ return super(print_prima_nota_cassa ,self)._get_account(data)
+
+ def _get_sortby(self, data):
+ if self.sortby == 'sort_date':
+ return 'Date'
+ elif self.sortby == 'sort_journal_partner':
+ return 'Journal & Partner'
+ return 'Date'
+
+report_sxw.report_sxw('report.account.print.prima_nota_cassa',
+ 'account.account',
+ 'addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako',
+ parser=print_prima_nota_cassa)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_it_prima_nota_cassa/reports.xml'
--- l10n_it_prima_nota_cassa/reports.xml 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/reports.xml 2013-02-12 14:33:27 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <report
+ auto="False"
+ id="prima_nota_cassa"
+ model="account.account"
+ name="account.print.prima_nota_cassa"
+ file="l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako"
+ string="Prima Nota Cassa"
+ report_type="webkit" />
+
+ </data>
+</openerp>
+
=== added directory 'l10n_it_prima_nota_cassa/wizard'
=== added file 'l10n_it_prima_nota_cassa/wizard/__init__.py'
--- l10n_it_prima_nota_cassa/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/wizard/__init__.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2011-2012 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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 wizard_print_prima_nota_cassa
=== added file 'l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py'
--- l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py 2013-02-12 14:33:27 +0000
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+# Copyright (C) 2011-2012 Associazione OpenERP Italia
+# (<http://www.openerp-italia.org>).
+# 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 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 osv import fields, osv
+
+class account_report_prima_nota_cassa(osv.osv_memory):
+ _inherit = "account.common.account.report"
+ _name = 'account.report.prima_nota_cassa'
+ _description = "Print Prima Nota Cassa"
+
+
+ def _get_all_journal(self, cr, uid, context=None):
+ return self.pool.get('account.journal').search(cr, uid , [('type','in',['cash','bank'])] )
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ if context is None:
+ context = {}
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
+ data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0])
+ if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record
+ data['form'].update({'initial_balance': False})
+ return { 'type': 'ir.actions.report.xml', 'report_name': 'account.print.prima_nota_cassa', 'datas': data}
+
+ _columns = {
+ 'initial_balance': fields.boolean('Include initial balances', help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
+ }
+ _defaults = {
+ 'journal_ids': _get_all_journal,
+ }
+
+
+account_report_prima_nota_cassa()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml'
--- l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml 1970-01-01 00:00:00 +0000
+++ l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml 2013-02-12 14:33:27 +0000
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="account_report_prima_nota_cassa" model="ir.ui.view">
+ <field name="name">Print Prima Nota Cassa</field>
+ <field name="model">account.report.prima_nota_cassa</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="account.account_common_report_view" />
+ <field name="arch" type="xml">
+ <data>
+ <xpath expr="/form/label[@string='']" position="replace">
+ <separator string="Prima Nota Cassa" colspan="4"/>
+ <label nolabel="1" colspan="4" string="This report prints a summary of all cash and bank moves in a given date or period range. It is possible to restrict analysis to single cash or bank accounts on the second tab."/>
+ </xpath>
+
+ <field name="journal_ids" position="replace">
+ <field name="journal_ids" domain="[('type','in',['cash'])]" />
+ </field>
+ <field name="target_move" position="after">
+ <field name="initial_balance"/>
+ </field>
+ </data>
+ </field>
+ </record>
+
+ <record id="action_account_prima_nota_cassa" model="ir.actions.act_window">
+ <field name="name">Prima Nota Cassa</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">account.report.prima_nota_cassa</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="account_report_prima_nota_cassa"/>
+ <field name="target">new</field>
+ </record>
+
+ <menuitem
+ icon="STOCK_PRINT"
+ name="Prima Nota Cassa"
+ parent="account.menu_journals_report"
+ action="action_account_prima_nota_cassa"
+ groups="account.group_account_manager,account.group_account_user"
+ id="menu_print_prima_nota_cassa"
+ />
+</data>
+</openerp>
Follow ups