Merge lp:~enlightx-deactivatedaccount/openobject-italia/adding_l10n_it_prima_nota_cassa into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0

Proposed by Davide Corio
Status: Merged
Merged at revision: 203
Proposed branch: lp:~enlightx-deactivatedaccount/openobject-italia/adding_l10n_it_prima_nota_cassa
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
Diff against target: 863 lines (+800/-0)
12 files modified
l10n_it_prima_nota_cassa/AUTHORS.txt (+2/-0)
l10n_it_prima_nota_cassa/README.txt (+5/-0)
l10n_it_prima_nota_cassa/__init__.py (+23/-0)
l10n_it_prima_nota_cassa/__openerp__.py (+39/-0)
l10n_it_prima_nota_cassa/i18n/it.po (+211/-0)
l10n_it_prima_nota_cassa/report/__init__.py (+21/-0)
l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako (+63/-0)
l10n_it_prima_nota_cassa/report/prima_nota_cassa.py (+298/-0)
l10n_it_prima_nota_cassa/reports.xml (+16/-0)
l10n_it_prima_nota_cassa/wizard/__init__.py (+22/-0)
l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py (+54/-0)
l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml (+46/-0)
To merge this branch: bzr merge lp:~enlightx-deactivatedaccount/openobject-italia/adding_l10n_it_prima_nota_cassa
Reviewer Review Type Date Requested Status
OpenERP Italia core devs Pending
Review via email: mp+147941@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Come per gli altri moduli, rimuoverei da ovunque la frase 'All Rights
Reserved', che ha poco senso.

Lascio a voi la scelta di lasciare o meno le tracce di lep :'D

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

direi che è abbastanza in contrasto con la licenza :)

rimuoviamo

204. By Davide Corio

[FIX] copyright

Revision history for this message
Lorenzo Battistini (elbati) wrote :

On 02/13/2013 09:01 AM, Davide Corio - agilebg.com wrote:
> direi che è abbastanza in contrasto con la licenza :)
>

Scusa, mi riferivo alla riga 499 del diff...

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

aggiornato, bisogna richiedere il merge con la revisione corretta?

205. By Davide Corio

[FIX] pdb import removed

Revision history for this message
Lorenzo Battistini (elbati) wrote :

On 02/13/2013 09:05 AM, Davide Corio - agilebg.com wrote:
> aggiornato, bisogna richiedere il merge con la revisione corretta?

No. Il diff del MP viene aggiornato con le tue ultime modifiche.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'l10n_it_prima_nota_cassa'
2=== added file 'l10n_it_prima_nota_cassa/AUTHORS.txt'
3--- l10n_it_prima_nota_cassa/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ l10n_it_prima_nota_cassa/AUTHORS.txt 2013-02-13 08:17:20 +0000
5@@ -0,0 +1,2 @@
6+Leonardo Pistone <leonardo.pistone@agilebg.com>
7+Lorenzo Battistini <lorenzo.battistini@agilebg.com>
8
9=== added file 'l10n_it_prima_nota_cassa/README.txt'
10--- l10n_it_prima_nota_cassa/README.txt 1970-01-01 00:00:00 +0000
11+++ l10n_it_prima_nota_cassa/README.txt 2013-02-13 08:17:20 +0000
12@@ -0,0 +1,5 @@
13+Questo modulo usa report_webkit.
14+E' necessario installare wkhtmltopdf per la stampa dei reports.
15+
16+La versione inclusa in Ubuntu necessità di alcune patch, quindi è più agevole scaricare l'eseguibile binario dal sito del progetto:
17+http://code.google.com/p/wkhtmltopdf/
18
19=== added file 'l10n_it_prima_nota_cassa/__init__.py'
20--- l10n_it_prima_nota_cassa/__init__.py 1970-01-01 00:00:00 +0000
21+++ l10n_it_prima_nota_cassa/__init__.py 2013-02-13 08:17:20 +0000
22@@ -0,0 +1,23 @@
23+# -*- coding: utf-8 -*-
24+##############################################################################
25+#
26+# Copyright (C) 2011-2013 Associazione OpenERP Italia
27+# (<http://www.openerp-italia.org>).
28+#
29+# This program is free software: you can redistribute it and/or modify
30+# it under the terms of the GNU Affero General Public License as published by
31+# the Free Software Foundation, either version 3 of the License, or
32+# (at your option) any later version.
33+#
34+# This program is distributed in the hope that it will be useful,
35+# but WITHOUT ANY WARRANTY; without even the implied warranty of
36+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37+# GNU General Public License for more details.
38+#
39+# You should have received a copy of the GNU Affero General Public License
40+# along with this program. If not, see <http://www.gnu.org/licenses/>.
41+#
42+##############################################################################
43+
44+import report
45+import wizard
46
47=== added file 'l10n_it_prima_nota_cassa/__openerp__.py'
48--- l10n_it_prima_nota_cassa/__openerp__.py 1970-01-01 00:00:00 +0000
49+++ l10n_it_prima_nota_cassa/__openerp__.py 2013-02-13 08:17:20 +0000
50@@ -0,0 +1,39 @@
51+# -*- coding: utf-8 -*-
52+##############################################################################
53+#
54+# Copyright (C) 2011-2013 Associazione OpenERP Italia
55+# (<http://www.openerp-italia.org>).
56+#
57+# This program is free software: you can redistribute it and/or modify
58+# it under the terms of the GNU Affero General Public License as published by
59+# the Free Software Foundation, either version 3 of the License, or
60+# (at your option) any later version.
61+#
62+# This program is distributed in the hope that it will be useful,
63+# but WITHOUT ANY WARRANTY; without even the implied warranty of
64+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65+# GNU General Public License for more details.
66+#
67+# You should have received a copy of the GNU Affero General Public License
68+# along with this program. If not, see <http://www.gnu.org/licenses/>.
69+#
70+##############################################################################
71+{
72+ 'name': 'Italian Localisation - Prima Nota Cassa',
73+ 'version': '0.1',
74+ 'category': 'Localisation/Italy',
75+ 'description': """Accounting reports - Prima Nota Cassa - Webkit""",
76+ 'author': 'OpenERP Italian Community',
77+ 'website': 'http://www.openerp-italia.org',
78+ 'license': 'AGPL-3',
79+ "depends" : ['account', 'report_webkit'],
80+ "init_xml" : [
81+ ],
82+ "update_xml" : [
83+ 'reports.xml',
84+ 'wizard/wizard_print_prima_nota_cassa.xml',
85+ ],
86+ "demo_xml" : [],
87+ "active": False,
88+ "installable": True
89+}
90
91=== added directory 'l10n_it_prima_nota_cassa/i18n'
92=== added file 'l10n_it_prima_nota_cassa/i18n/it.po'
93--- l10n_it_prima_nota_cassa/i18n/it.po 1970-01-01 00:00:00 +0000
94+++ l10n_it_prima_nota_cassa/i18n/it.po 2013-02-13 08:17:20 +0000
95@@ -0,0 +1,211 @@
96+# Translation of OpenERP Server.
97+# This file contains the translation of the following modules:
98+# * l10n_it_prima_nota_cassa
99+#
100+msgid ""
101+msgstr ""
102+"Project-Id-Version: OpenERP Server 7.0\n"
103+"Report-Msgid-Bugs-To: \n"
104+"POT-Creation-Date: 2013-02-12 09:09+0000\n"
105+"PO-Revision-Date: 2013-02-12 10:16+0100\n"
106+"Last-Translator: Davide Corio <davide.corio@agilebg.com>\n"
107+"Language-Team: \n"
108+"MIME-Version: 1.0\n"
109+"Content-Type: text/plain; charset=UTF-8\n"
110+"Content-Transfer-Encoding: 8bit\n"
111+"Plural-Forms: \n"
112+
113+#. module: l10n_it_prima_nota_cassa
114+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:8
115+msgid "Prime entry"
116+msgstr "Prima Nota"
117+
118+#. module: l10n_it_prima_nota_cassa
119+#: selection:account.report.prima_nota_cassa,filter:0
120+msgid "No Filters"
121+msgstr "Nessun Filtro"
122+
123+#. module: l10n_it_prima_nota_cassa
124+#: view:account.report.prima_nota_cassa:0
125+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."
126+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."
127+
128+#. module: l10n_it_prima_nota_cassa
129+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:43
130+#: code:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.py:38
131+#, python-format
132+msgid "Debit"
133+msgstr "Debito"
134+
135+#. module: l10n_it_prima_nota_cassa
136+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:16
137+msgid "Filter By"
138+msgstr "Filtra Per"
139+
140+#. module: l10n_it_prima_nota_cassa
141+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:42
142+msgid "Entry"
143+msgstr "Registrazione"
144+
145+#. module: l10n_it_prima_nota_cassa
146+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:40
147+msgid "Ref"
148+msgstr "Rif"
149+
150+#. module: l10n_it_prima_nota_cassa
151+#: field:account.report.prima_nota_cassa,company_id:0
152+msgid "Company"
153+msgstr "Azienda"
154+
155+#. module: l10n_it_prima_nota_cassa
156+#: model:ir.model,name:l10n_it_prima_nota_cassa.model_account_report_prima_nota_cassa
157+msgid "Print Prima Nota Cassa"
158+msgstr "Stampa Prima Nota"
159+
160+#. module: l10n_it_prima_nota_cassa
161+#: field:account.report.prima_nota_cassa,initial_balance:0
162+msgid "Include initial balances"
163+msgstr "Includi saldi iniziali"
164+
165+#. module: l10n_it_prima_nota_cassa
166+#: selection:account.report.prima_nota_cassa,display_account:0
167+msgid "With balance is not equal to 0"
168+msgstr "Con saldo diverso da 0"
169+
170+#. module: l10n_it_prima_nota_cassa
171+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:15
172+msgid "Jounal"
173+msgstr "Sezionale"
174+
175+#. module: l10n_it_prima_nota_cassa
176+#: selection:account.report.prima_nota_cassa,filter:0
177+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:37
178+msgid "Date"
179+msgstr "Data"
180+
181+#. module: l10n_it_prima_nota_cassa
182+#: field:account.report.prima_nota_cassa,chart_account_id:0
183+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:13
184+msgid "Chart of Account"
185+msgstr "Piano dei Conti"
186+
187+#. module: l10n_it_prima_nota_cassa
188+#: field:account.report.prima_nota_cassa,journal_ids:0
189+msgid "Journals"
190+msgstr "Sezionali"
191+
192+#. module: l10n_it_prima_nota_cassa
193+#: field:account.report.prima_nota_cassa,target_move:0
194+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:17
195+msgid "Target Moves"
196+msgstr "Movimenti"
197+
198+#. module: l10n_it_prima_nota_cassa
199+#: help:account.report.prima_nota_cassa,chart_account_id:0
200+msgid "Select Charts of Accounts"
201+msgstr "Seleziona Piano dei Conti"
202+
203+#. module: l10n_it_prima_nota_cassa
204+#: field:account.report.prima_nota_cassa,date_to:0
205+msgid "End Date"
206+msgstr "Data Fine"
207+
208+#. module: l10n_it_prima_nota_cassa
209+#: field:account.report.prima_nota_cassa,period_from:0
210+msgid "Start Period"
211+msgstr "Periodo Iniziale"
212+
213+#. module: l10n_it_prima_nota_cassa
214+#: selection:account.report.prima_nota_cassa,target_move:0
215+msgid "All Posted Entries"
216+msgstr "Tutti i movimenti confermati"
217+
218+#. module: l10n_it_prima_nota_cassa
219+#: help:account.report.prima_nota_cassa,fiscalyear_id:0
220+msgid "Keep empty for all open fiscal year"
221+msgstr "Lasciare vuoto per tutti gli anni fiscali aperti"
222+
223+#. module: l10n_it_prima_nota_cassa
224+#: field:account.report.prima_nota_cassa,period_to:0
225+msgid "End Period"
226+msgstr "Periodo Finale"
227+
228+#. module: l10n_it_prima_nota_cassa
229+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:44
230+msgid "Credit"
231+msgstr "Credito"
232+
233+#. module: l10n_it_prima_nota_cassa
234+#: field:account.report.prima_nota_cassa,fiscalyear_id:0
235+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:14
236+msgid "Fiscal Year"
237+msgstr "Anno Fiscale"
238+
239+#. module: l10n_it_prima_nota_cassa
240+#: field:account.report.prima_nota_cassa,display_account:0
241+msgid "Display Accounts"
242+msgstr "Mostra Conti"
243+
244+#. module: l10n_it_prima_nota_cassa
245+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:45
246+msgid "Balance"
247+msgstr "Saldo"
248+
249+#. module: l10n_it_prima_nota_cassa
250+#: view:account.report.prima_nota_cassa:0
251+#: model:ir.actions.act_window,name:l10n_it_prima_nota_cassa.action_account_prima_nota_cassa
252+#: model:ir.actions.report.xml,name:l10n_it_prima_nota_cassa.prima_nota_cassa
253+#: model:ir.ui.menu,name:l10n_it_prima_nota_cassa.menu_print_prima_nota_cassa
254+msgid "Prima Nota Cassa"
255+msgstr "Prima Nota Cassa"
256+
257+#. module: l10n_it_prima_nota_cassa
258+#: selection:account.report.prima_nota_cassa,display_account:0
259+msgid "With movements"
260+msgstr "Con movimenti"
261+
262+#. module: l10n_it_prima_nota_cassa
263+#: selection:account.report.prima_nota_cassa,display_account:0
264+msgid "All"
265+msgstr "Tutti"
266+
267+#. module: l10n_it_prima_nota_cassa
268+#: help:account.report.prima_nota_cassa,initial_balance:0
269+msgid "It adds initial balance row on report which display previous sum amount of debit/credit/balance"
270+msgstr "Aggiunge una riga per il saldo iniziale sul report, che mostrerà la somma precedente per debiti/crediti/saldo"
271+
272+#. module: l10n_it_prima_nota_cassa
273+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:41
274+msgid "Move"
275+msgstr "Movimento"
276+
277+#. module: l10n_it_prima_nota_cassa
278+#: selection:account.report.prima_nota_cassa,filter:0
279+msgid "Periods"
280+msgstr "Periodi"
281+
282+#. module: l10n_it_prima_nota_cassa
283+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:38
284+msgid "JRNL"
285+msgstr "Sezionale"
286+
287+#. module: l10n_it_prima_nota_cassa
288+#: report:addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako:39
289+msgid "Partner"
290+msgstr "Partner"
291+
292+#. module: l10n_it_prima_nota_cassa
293+#: field:account.report.prima_nota_cassa,date_from:0
294+msgid "Start Date"
295+msgstr "Data Inizio"
296+
297+#. module: l10n_it_prima_nota_cassa
298+#: field:account.report.prima_nota_cassa,filter:0
299+msgid "Filter by"
300+msgstr "Filtra per"
301+
302+#. module: l10n_it_prima_nota_cassa
303+#: selection:account.report.prima_nota_cassa,target_move:0
304+msgid "All Entries"
305+msgstr "Tutti i movimenti"
306+
307
308=== added directory 'l10n_it_prima_nota_cassa/report'
309=== added file 'l10n_it_prima_nota_cassa/report/__init__.py'
310--- l10n_it_prima_nota_cassa/report/__init__.py 1970-01-01 00:00:00 +0000
311+++ l10n_it_prima_nota_cassa/report/__init__.py 2013-02-13 08:17:20 +0000
312@@ -0,0 +1,21 @@
313+# -*- coding: utf-8 -*-
314+##############################################################################
315+#
316+# Copyright (C) 2011-2013 Associazione OpenERP Italia
317+# (<http://www.openerp-italia.org>).
318+#
319+# This program is free software: you can redistribute it and/or modify
320+# it under the terms of the GNU Affero General Public License as published by
321+# the Free Software Foundation, either version 3 of the License, or
322+# (at your option) any later version.
323+#
324+# This program is distributed in the hope that it will be useful,
325+# but WITHOUT ANY WARRANTY; without even the implied warranty of
326+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
327+# GNU General Public License for more details.
328+#
329+# You should have received a copy of the GNU Affero General Public License
330+# along with this program. If not, see <http://www.gnu.org/licenses/>.
331+#
332+##############################################################################
333+import prima_nota_cassa
334
335=== added file 'l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako'
336--- l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako 1970-01-01 00:00:00 +0000
337+++ l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako 2013-02-13 08:17:20 +0000
338@@ -0,0 +1,63 @@
339+<html>
340+ <head>
341+ <style type="text/css">
342+ ${css}
343+ </style>
344+ </head>
345+ <body>
346+ <h1 class="title">${_("Prime entry")} </h1>
347+
348+ <table class="basic_table" width="90%">
349+ <tr>
350+ <td>${ _("Chart of Account") }</td>
351+ <td>${ _("Fiscal Year") }</td>
352+ <td>${ _("Jounal")}</td>
353+ <td>${ _("Filter By") }</td>
354+ <td>${ _("Target Moves") }</td>
355+ </tr>
356+ <tr>
357+
358+ <td>${ get_account(data) or '' }</td>
359+ <td>${ get_fiscalyear(data) or '' }</td>
360+ <td>${ ', '.join([ lt or '' for lt in get_journal(data)]) }</td>
361+ <td>${ get_filter(data) or '' }</td>
362+ <td>${ get_target_move(data) }</td>
363+ </tr>
364+ </table>
365+
366+ <br />
367+
368+ <div id="results">
369+ % for a in objects:
370+ <% setLang(company.partner_id.lang) %>
371+ <table class="list_table" width="90%">
372+ <tr>
373+ <th> ${ _('Date') }</th>
374+ <th> ${ _('Journal') }</th>
375+ <th> ${ _('Partner') }</th>
376+ <th> ${ _('Entry') }</th>
377+ <th> ${ _('Description') }</th>
378+ <th> ${ _('Debit') }</th>
379+ <th> ${ _('Credit') }</th>
380+ <th> ${ _('Balance') }</th>
381+ </tr>
382+
383+
384+ %for line in lines(a) :
385+ <tr style="page-break-inside: avoid; vertical-align:text-top;">
386+ <td>${ formatLang(line['ldate'], date=True) or ''|entity }</td>
387+ <td>${ line['jname'] or ''|entity }</td>
388+ <td>${ line['partner_name'] or ''|entity }</td>
389+ <td>${ line['move'] or ''|entity }</td>
390+ <td>${ line['lname'] or ''|entity }</td>
391+ <td>${ formatLang(line['debit'], digits=get_digits(dp='Account')) |entity}</td>
392+ <td>${ formatLang(line['credit'], digits=get_digits(dp='Account')) |entity}</td>
393+ <td>${ line['debit'] - line['credit'] |entity}</td>
394+ </tr>
395+ %endfor
396+ </table>
397+ %endfor
398+
399+ </div>
400+ </body>
401+</html>
402
403=== added file 'l10n_it_prima_nota_cassa/report/prima_nota_cassa.py'
404--- l10n_it_prima_nota_cassa/report/prima_nota_cassa.py 1970-01-01 00:00:00 +0000
405+++ l10n_it_prima_nota_cassa/report/prima_nota_cassa.py 2013-02-13 08:17:20 +0000
406@@ -0,0 +1,298 @@
407+# -*- coding: utf-8 -*-
408+##############################################################################
409+#
410+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
411+# Copyright (C) 2011-2013 Associazione OpenERP Italia
412+# (<http://www.openerp-italia.org>).
413+#
414+# This program is free software: you can redistribute it and/or modify
415+# it under the terms of the GNU Affero General Public License as published by
416+# the Free Software Foundation, either version 3 of the License, or
417+# (at your option) any later version.
418+#
419+# This program is distributed in the hope that it will be useful,
420+# but WITHOUT ANY WARRANTY; without even the implied warranty of
421+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
422+# GNU General Public License for more details.
423+#
424+# You should have received a copy of the GNU Affero General Public License
425+# along with this program. If not, see <http://www.gnu.org/licenses/>.
426+#
427+##############################################################################
428+
429+import time
430+from report import report_sxw
431+from account.report.common_report_header import common_report_header
432+from tools.translate import _
433+
434+class print_prima_nota_cassa(report_sxw.rml_parse, common_report_header):
435+ _name = 'report.account.prima_nota_cassa'
436+
437+ def set_context(self, objects, data, ids, report_type=None):
438+ new_ids = ids
439+ obj_move = self.pool.get('account.move.line')
440+ self.sortby = data['form'].get('sortby', 'sort_date')
441+ self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{}))
442+ ctx2 = data['form'].get('used_context',{}).copy()
443+ self.init_balance = data['form']['initial_balance']
444+ self.display_account = data['form']['display_account']
445+ self.target_move = data['form'].get('target_move', 'all')
446+ self.journal_ids = data['form'].get('journal_ids', [])
447+ ctx = self.context.copy()
448+ ctx['fiscalyear'] = data['form']['fiscalyear_id']
449+ if data['form']['filter'] == 'filter_period':
450+ ctx['periods'] = data['form']['periods']
451+ elif data['form']['filter'] == 'filter_date':
452+ ctx['date_from'] = data['form']['date_from']
453+ ctx['date_to'] = data['form']['date_to']
454+ ctx['state'] = data['form']['target_move']
455+ self.context.update(ctx)
456+ if (data['model'] == 'ir.ui.menu'):
457+ new_ids = [data['form']['chart_account_id']]
458+ objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
459+ return super(print_prima_nota_cassa, self).set_context(objects, data, new_ids, report_type=report_type)
460+
461+ def __init__(self, cr, uid, name, context=None):
462+ if context is None:
463+ context = {}
464+ super(print_prima_nota_cassa, self).__init__(cr, uid, name, context=context)
465+ self.query = ""
466+ self.tot_currency = 0.0
467+ self.period_sql = ""
468+ self.sold_accounts = {}
469+ self.sortby = 'sort_date'
470+ self.localcontext.update( {
471+ 'time': time,
472+ 'lines': self.lines,
473+ 'sum_debit_account': self._sum_debit_account,
474+ 'sum_credit_account': self._sum_credit_account,
475+ 'sum_balance_account': self._sum_balance_account,
476+ 'sum_currency_amount_account': self._sum_currency_amount_account,
477+ 'get_fiscalyear': self._get_fiscalyear,
478+ 'get_journal': self._get_journal,
479+ 'get_account': self._get_account,
480+ 'get_start_period': self.get_start_period,
481+ 'get_end_period': self.get_end_period,
482+ 'get_filter': self._get_filter,
483+ 'get_sortby': self._get_sortby,
484+ 'get_start_date':self._get_start_date,
485+ 'get_end_date':self._get_end_date,
486+ 'get_target_move': self._get_target_move,
487+ 'ipdb': self.ipdb
488+ })
489+ self.context = context
490+
491+ def _sum_currency_amount_account(self, account):
492+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
493+ FROM account_move_line l \
494+ WHERE l.account_id = %s AND %s' %(account.id, self.query))
495+ sum_currency = self.cr.fetchone()[0] or 0.0
496+ if self.init_balance:
497+ self.cr.execute('SELECT sum(l.amount_currency) AS tot_currency \
498+ FROM account_move_line l \
499+ WHERE l.account_id = %s AND %s '%(account.id, self.init_query))
500+ sum_currency += self.cr.fetchone()[0] or 0.0
501+ return sum_currency
502+
503+ def get_children_accounts(self, account):
504+ """ Return all the accounts that are children of the chosen main one
505+ and are set as default for the selected cash and bank accounts"""
506+
507+ currency_obj = self.pool.get('res.currency')
508+ journal_obj = self.pool.get('account.journal')
509+
510+ cash_bank_journals = journal_obj.search(self.cr, self.uid, [ ('type','in',('bank','cash')) ] )
511+
512+ cash_bank_accounts = [journal_obj.browse(self.cr, self.uid, j).default_credit_account_id.id for j in cash_bank_journals] + \
513+ [journal_obj.browse(self.cr, self.uid, j).default_debit_account_id.id for j in cash_bank_journals]
514+
515+ ids_acc = [acc for acc in self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account.id) \
516+ if acc in cash_bank_accounts]
517+
518+ currency = account.currency_id and account.currency_id or account.company_id.currency_id
519+
520+ return ids_acc
521+
522+ def lines(self, main_account):
523+ """ Return all the account_move_line of account with their account code counterparts """
524+ account_ids = self.get_children_accounts(main_account)
525+
526+ move_state = ['draft','posted']
527+ if self.target_move == 'posted':
528+ move_state = ['posted', '']
529+
530+ # Then select all account_move_line of this account
531+ if self.sortby == 'sort_journal_partner':
532+ sql_sort='j.code, p.name, l.move_id'
533+ else:
534+ sql_sort='l.date, l.move_id'
535+ sql = """
536+ SELECT
537+ l.id AS lid,
538+ l.date AS ldate,
539+ j.code AS lcode,
540+ j.name AS jname,
541+ l.currency_id,
542+ l.amount_currency,
543+ l.ref AS lref,
544+ l.name AS lname,
545+ COALESCE(l.debit,0) AS debit,
546+ COALESCE(l.credit,0) AS credit,
547+ l.period_id AS lperiod_id,
548+ l.partner_id AS lpartner_id,
549+ m.name AS move_name,
550+ m.id AS mmove_id,
551+ per.code as period_code,
552+ c.symbol AS currency_code,
553+ i.id AS invoice_id,
554+ i.type AS invoice_type,
555+ i.number AS invoice_number,
556+ p.name AS partner_name
557+ FROM account_move_line l
558+ JOIN account_move m on (l.move_id=m.id)
559+ LEFT JOIN res_currency c on (l.currency_id=c.id)
560+ LEFT JOIN res_partner p on (l.partner_id=p.id)
561+ LEFT JOIN account_invoice i on (m.id =i.move_id)
562+ LEFT JOIN account_period per on (per.id=l.period_id)
563+ JOIN account_journal j on (l.journal_id=j.id)
564+ WHERE %s
565+ AND m.state IN %s
566+ AND l.account_id in %%s
567+ ORDER by %s
568+ """ %(self.query, tuple(move_state), sql_sort)
569+ self.cr.execute(sql, (tuple(account_ids),))
570+ res = self.cr.dictfetchall()
571+ for l in res:
572+ l['move'] = l['move_name'] != '/' and l['move_name'] or ('*'+str(l['mmove_id']))
573+ l['partner'] = l['partner_name'] or ''
574+ # Modification of amount Currency
575+ if l['credit'] > 0:
576+ if l['amount_currency'] != None:
577+ l['amount_currency'] = abs(l['amount_currency']) * -1
578+ if l['amount_currency'] != None:
579+ self.tot_currency = self.tot_currency + l['amount_currency']
580+ return res
581+
582+ def _sum_total_debit(self, account):
583+ move_state = ['draft','posted']
584+
585+ account_ids = self.get_children_accounts(main_account)
586+
587+ if self.target_move == 'posted':
588+ move_state = ['posted','']
589+ self.cr.execute('SELECT sum(debit) \
590+ FROM account_move_line l \
591+ JOIN account_move am ON (am.id = l.move_id) \
592+ WHERE (l.account_id = %s) \
593+ AND (am.state IN %s) \
594+ AND '+ self.query +' '
595+ ,(account.id, tuple(move_state)))
596+ sum_debit = self.cr.fetchone()[0] or 0.0
597+ if self.init_balance:
598+ self.cr.execute('SELECT sum(debit) \
599+ FROM account_move_line l \
600+ JOIN account_move am ON (am.id = l.move_id) \
601+ WHERE (l.account_id = %s) \
602+ AND (am.state IN %s) \
603+ AND '+ self.init_query +' '
604+ ,(account.id, tuple(move_state)))
605+ # Add initial balance to the result
606+ sum_debit += self.cr.fetchone()[0] or 0.0
607+ return sum_debit
608+
609+ def _sum_debit_account(self, account):
610+ if account.type == 'view':
611+ return account.debit
612+ move_state = ['draft','posted']
613+ if self.target_move == 'posted':
614+ move_state = ['posted','']
615+ self.cr.execute('SELECT sum(debit) \
616+ FROM account_move_line l \
617+ JOIN account_move am ON (am.id = l.move_id) \
618+ WHERE (l.account_id = %s) \
619+ AND (am.state IN %s) \
620+ AND '+ self.query +' '
621+ ,(account.id, tuple(move_state)))
622+ sum_debit = self.cr.fetchone()[0] or 0.0
623+ if self.init_balance:
624+ self.cr.execute('SELECT sum(debit) \
625+ FROM account_move_line l \
626+ JOIN account_move am ON (am.id = l.move_id) \
627+ WHERE (l.account_id = %s) \
628+ AND (am.state IN %s) \
629+ AND '+ self.init_query +' '
630+ ,(account.id, tuple(move_state)))
631+ # Add initial balance to the result
632+ sum_debit += self.cr.fetchone()[0] or 0.0
633+ return sum_debit
634+
635+ def _sum_credit_account(self, account):
636+ if account.type == 'view':
637+ return account.credit
638+ move_state = ['draft','posted']
639+ if self.target_move == 'posted':
640+ move_state = ['posted','']
641+ self.cr.execute('SELECT sum(credit) \
642+ FROM account_move_line l \
643+ JOIN account_move am ON (am.id = l.move_id) \
644+ WHERE (l.account_id = %s) \
645+ AND (am.state IN %s) \
646+ AND '+ self.query +' '
647+ ,(account.id, tuple(move_state)))
648+ sum_credit = self.cr.fetchone()[0] or 0.0
649+ if self.init_balance:
650+ self.cr.execute('SELECT sum(credit) \
651+ FROM account_move_line l \
652+ JOIN account_move am ON (am.id = l.move_id) \
653+ WHERE (l.account_id = %s) \
654+ AND (am.state IN %s) \
655+ AND '+ self.init_query +' '
656+ ,(account.id, tuple(move_state)))
657+ # Add initial balance to the result
658+ sum_credit += self.cr.fetchone()[0] or 0.0
659+ return sum_credit
660+
661+ def _sum_balance_account(self, account):
662+ if account.type == 'view':
663+ return account.balance
664+ move_state = ['draft','posted']
665+ if self.target_move == 'posted':
666+ move_state = ['posted','']
667+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
668+ FROM account_move_line l \
669+ JOIN account_move am ON (am.id = l.move_id) \
670+ WHERE (l.account_id = %s) \
671+ AND (am.state IN %s) \
672+ AND '+ self.query +' '
673+ ,(account.id, tuple(move_state)))
674+ sum_balance = self.cr.fetchone()[0] or 0.0
675+ if self.init_balance:
676+ self.cr.execute('SELECT (sum(debit) - sum(credit)) as tot_balance \
677+ FROM account_move_line l \
678+ JOIN account_move am ON (am.id = l.move_id) \
679+ WHERE (l.account_id = %s) \
680+ AND (am.state IN %s) \
681+ AND '+ self.init_query +' '
682+ ,(account.id, tuple(move_state)))
683+ # Add initial balance to the result
684+ sum_balance += self.cr.fetchone()[0] or 0.0
685+ return sum_balance
686+
687+ def _get_account(self, data):
688+ if data['model'] == 'account.account':
689+ return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
690+ return super(print_prima_nota_cassa ,self)._get_account(data)
691+
692+ def _get_sortby(self, data):
693+ if self.sortby == 'sort_date':
694+ return 'Date'
695+ elif self.sortby == 'sort_journal_partner':
696+ return 'Journal & Partner'
697+ return 'Date'
698+
699+report_sxw.report_sxw('report.account.print.prima_nota_cassa',
700+ 'account.account',
701+ 'addons/l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako',
702+ parser=print_prima_nota_cassa)
703+
704+
705
706=== added file 'l10n_it_prima_nota_cassa/reports.xml'
707--- l10n_it_prima_nota_cassa/reports.xml 1970-01-01 00:00:00 +0000
708+++ l10n_it_prima_nota_cassa/reports.xml 2013-02-13 08:17:20 +0000
709@@ -0,0 +1,16 @@
710+<?xml version="1.0"?>
711+<openerp>
712+ <data>
713+
714+ <report
715+ auto="False"
716+ id="prima_nota_cassa"
717+ model="account.account"
718+ name="account.print.prima_nota_cassa"
719+ file="l10n_it_prima_nota_cassa/report/prima_nota_cassa.mako"
720+ string="Prima Nota Cassa"
721+ report_type="webkit" />
722+
723+ </data>
724+</openerp>
725+
726
727=== added directory 'l10n_it_prima_nota_cassa/wizard'
728=== added file 'l10n_it_prima_nota_cassa/wizard/__init__.py'
729--- l10n_it_prima_nota_cassa/wizard/__init__.py 1970-01-01 00:00:00 +0000
730+++ l10n_it_prima_nota_cassa/wizard/__init__.py 2013-02-13 08:17:20 +0000
731@@ -0,0 +1,22 @@
732+# -*- coding: utf-8 -*-
733+##############################################################################
734+#
735+# Copyright (C) 2011-2012 Associazione OpenERP Italia
736+# (<http://www.openerp-italia.org>).
737+# All Rights Reserved
738+#
739+# This program is free software: you can redistribute it and/or modify
740+# it under the terms of the GNU Affero General Public License as published by
741+# the Free Software Foundation, either version 3 of the License, or
742+# (at your option) any later version.
743+#
744+# This program is distributed in the hope that it will be useful,
745+# but WITHOUT ANY WARRANTY; without even the implied warranty of
746+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747+# GNU General Public License for more details.
748+#
749+# You should have received a copy of the GNU Affero General Public License
750+# along with this program. If not, see <http://www.gnu.org/licenses/>.
751+#
752+##############################################################################
753+import wizard_print_prima_nota_cassa
754
755=== added file 'l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py'
756--- l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py 1970-01-01 00:00:00 +0000
757+++ l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.py 2013-02-13 08:17:20 +0000
758@@ -0,0 +1,54 @@
759+# -*- coding: utf-8 -*-
760+##############################################################################
761+#
762+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
763+# Copyright (C) 2011-2012 Associazione OpenERP Italia
764+# (<http://www.openerp-italia.org>).
765+# All Rights Reserved
766+#
767+# This program is free software: you can redistribute it and/or modify
768+# it under the terms of the GNU Affero General Public License as published by
769+# the Free Software Foundation, either version 3 of the License, or
770+# (at your option) any later version.
771+#
772+# This program is distributed in the hope that it will be useful,
773+# but WITHOUT ANY WARRANTY; without even the implied warranty of
774+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
775+# GNU General Public License for more details.
776+#
777+# You should have received a copy of the GNU Affero General Public License
778+# along with this program. If not, see <http://www.gnu.org/licenses/>.
779+#
780+##############################################################################
781+
782+from osv import fields, osv
783+
784+class account_report_prima_nota_cassa(osv.osv_memory):
785+ _inherit = "account.common.account.report"
786+ _name = 'account.report.prima_nota_cassa'
787+ _description = "Print Prima Nota Cassa"
788+
789+
790+ def _get_all_journal(self, cr, uid, context=None):
791+ return self.pool.get('account.journal').search(cr, uid , [('type','in',['cash','bank'])] )
792+
793+ def _print_report(self, cr, uid, ids, data, context=None):
794+ if context is None:
795+ context = {}
796+ data = self.pre_print_report(cr, uid, ids, data, context=context)
797+ data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0])
798+ if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record
799+ data['form'].update({'initial_balance': False})
800+ return { 'type': 'ir.actions.report.xml', 'report_name': 'account.print.prima_nota_cassa', 'datas': data}
801+
802+ _columns = {
803+ 'initial_balance': fields.boolean('Include initial balances', help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
804+ }
805+ _defaults = {
806+ 'journal_ids': _get_all_journal,
807+ }
808+
809+
810+account_report_prima_nota_cassa()
811+
812+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
813
814=== added file 'l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml'
815--- l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml 1970-01-01 00:00:00 +0000
816+++ l10n_it_prima_nota_cassa/wizard/wizard_print_prima_nota_cassa.xml 2013-02-13 08:17:20 +0000
817@@ -0,0 +1,46 @@
818+<?xml version="1.0" encoding="utf-8"?>
819+<openerp>
820+ <data>
821+
822+ <record id="account_report_prima_nota_cassa" model="ir.ui.view">
823+ <field name="name">Print Prima Nota Cassa</field>
824+ <field name="model">account.report.prima_nota_cassa</field>
825+ <field name="type">form</field>
826+ <field name="inherit_id" ref="account.account_common_report_view" />
827+ <field name="arch" type="xml">
828+ <data>
829+ <xpath expr="/form/label[@string='']" position="replace">
830+ <separator string="Prima Nota Cassa" colspan="4"/>
831+ <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."/>
832+ </xpath>
833+
834+ <field name="journal_ids" position="replace">
835+ <field name="journal_ids" domain="[('type','in',['cash'])]" />
836+ </field>
837+ <field name="target_move" position="after">
838+ <field name="initial_balance"/>
839+ </field>
840+ </data>
841+ </field>
842+ </record>
843+
844+ <record id="action_account_prima_nota_cassa" model="ir.actions.act_window">
845+ <field name="name">Prima Nota Cassa</field>
846+ <field name="type">ir.actions.act_window</field>
847+ <field name="res_model">account.report.prima_nota_cassa</field>
848+ <field name="view_type">form</field>
849+ <field name="view_mode">form</field>
850+ <field name="view_id" ref="account_report_prima_nota_cassa"/>
851+ <field name="target">new</field>
852+ </record>
853+
854+ <menuitem
855+ icon="STOCK_PRINT"
856+ name="Prima Nota Cassa"
857+ parent="account.menu_journals_report"
858+ action="action_account_prima_nota_cassa"
859+ groups="account.group_account_manager,account.group_account_user"
860+ id="menu_print_prima_nota_cassa"
861+ />
862+</data>
863+</openerp>

Subscribers

People subscribed via source and target branches