Merge lp:~icsergio/openobject-italia/remake-vat-registries into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0

Proposed by Sergio Corato
Status: Rejected
Rejected by: Sergio Corato
Proposed branch: lp:~icsergio/openobject-italia/remake-vat-registries
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
Diff against target: 1003 lines (+943/-0)
11 files modified
account_vat_registries_webkit/__init__.py (+24/-0)
account_vat_registries_webkit/__openerp__.py (+51/-0)
account_vat_registries_webkit/data/financial_webkit_header.xml (+413/-0)
account_vat_registries_webkit/report/__init__.py (+21/-0)
account_vat_registries_webkit/report/report.xml (+27/-0)
account_vat_registries_webkit/report/templates/account_report_vat_registries.mako (+132/-0)
account_vat_registries_webkit/report/vat_registries.py (+132/-0)
account_vat_registries_webkit/report_menus.xml (+11/-0)
account_vat_registries_webkit/wizard/__init__.py (+23/-0)
account_vat_registries_webkit/wizard/vatregistries_wizard.py (+60/-0)
account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml (+49/-0)
To merge this branch: bzr merge lp:~icsergio/openobject-italia/remake-vat-registries
Reviewer Review Type Date Requested Status
Lorenzo Battistini Needs Fixing
OpenERP Italia core devs Pending
Review via email: mp+152598@code.launchpad.net

Description of the change

Proposal to substitute l10n_it_vat_registries with vatregistries_webkit.
The latter one works correctly with this branch: https://code.launchpad.net/~icsergio/openobject-addons/trunk-improve-l10n_it-taxes , which adds some tax codes for completely configure the taxes.
The taxes' values and sums are taken as they are from database, without risky computations on the fly.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Rinominerei il modulo in 'account_vat_registries_webkit'.

Allego una stampa di registro IVA acquisti con 7 fatture + 1 nota di
credito.

Che ne dici di aggiungere un separatore fra le righe di fatture diverse?
In modo da distinguere le fatture.

I file 'common_reports.py' e 'webkit_parser_header_fix.py' servono? A cosa?
Il file 'wizard.xml' direi che non serve.

Revision history for this message
Lorenzo Battistini (elbati) wrote :
207. By Sergio Corato

[FIX] renamed module and row separator implementation

Revision history for this message
Sergio Corato (icsergio) wrote :

Il 18/03/2013 19:52, Lorenzo Battistini - Agile BG ha scritto:
> Ecco la stampa di esempio: http://www.openerp-italia.org/images/vat_registries_webkit.pdf
>
bisognerebbe anche mettere nel footer la numerazione fiscale (tipo pag.
1/2013), inserendo nel wizard di stampa la richiesta per il n. di pagina
da cui partire e passare al footer una variabile personalizzata (ma si può?)

--
Sergio Corato

IcsTools.it

web : www.icstools.it
skype : sergiocorato
mail : <email address hidden>

Revision history for this message
Sergio Corato (icsergio) wrote :

Il 01/04/2013 22:40, Sergio Corato ha scritto:
> Il 18/03/2013 19:52, Lorenzo Battistini - Agile BG ha scritto:
>> Ecco la stampa di esempio: http://www.openerp-italia.org/images/vat_registries_webkit.pdf
>>
> bisognerebbe anche mettere nel footer la numerazione fiscale (tipo pag.
> 1/2013), inserendo nel wizard di stampa la richiesta per il n. di pagina
> da cui partire e passare al footer una variabile personalizzata (ma si può?)
>
mi rispondo da solo: sì
e ho fatto, appena completo aggiorno il branch

--
Sergio Corato

IcsTools.it

web : www.icstools.it
skype : sergiocorato
mail : <email address hidden>

208. By Sergio Corato

[IMP] Added fiscal number print in the footer

Revision history for this message
Sergio Corato (icsergio) wrote :

Il 18/03/2013 19:46, Lorenzo Battistini - Agile BG ha scritto:
> Rinominerei il modulo in 'account_vat_registries_webkit'.
>
> Allego una stampa di registro IVA acquisti con 7 fatture + 1 nota di
> credito.
>
> Che ne dici di aggiungere un separatore fra le righe di fatture diverse?
> In modo da distinguere le fatture.
>
> I file 'common_reports.py' e 'webkit_parser_header_fix.py' servono? A cosa?
> Il file 'wizard.xml' direi che non serve.
>
ho aggiornato il branch con la numerazione fiscale delle pagine (tipo
x/anno) con l'x sulla base del numero inserito nel wizard
allego una stampa di prova

--
Sergio Corato

IcsTools.it

web : www.icstools.it
skype : sergiocorato
mail : <email address hidden>

209. By Sergio Corato

[ADD] some missing fields

Revision history for this message
Lorenzo Battistini (elbati) wrote :
Download full text (7.7 KiB)

Ho installato il modulo su un nuovo db e stampando ottengo

2013-04-09 10:26:31,330 12946 ERROR test_70 openerp.addons.report_webkit.webkit_report:

Traceback (most recent call last):
  File "/home/elbati/workspace/openerp/7.0/addons/report_webkit/webkit_report.py", line 266, in create_single_pdf
    **self.parser_instance.localcontext)
  File "/usr/lib/python2.7/dist-packages/mako/template.py", line 412, in render
    return runtime._render(self, self.callable_, args, data)
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 766, in _render
    **_kwargs_for_callable(callable_, data))
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 798, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 824, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0xb400966cL", line 82, in render_body
    <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.registration_date, date=True)|entity}</div>
  File "/home/elbati/workspace/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: "Field 'registration_date' does not exist in object 'browse_record(account.invoice, 1)'"

2013-04-09 10:26:31,332 12946 ERROR test_70 openerp.service.web_services: Exception: (u'Webkit render!', u'\n\nTraceback (most recent call last):\n File "/home/elbati/workspace/openerp/7.0/addons/report_webkit/webkit_report.py", line 266, in create_single_pdf\n **self.parser_instance.localcontext)\n File "/usr/lib/python2.7/dist-packages/mako/template.py", line 412, in render\n return runtime._render(self, self.callable_, args, data)\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 766, in _render\n **_kwargs_for_callable(callable_, data))\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 798, in _render_context\n _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 824, in _exec_template\n callable_(context, *args, **kwargs)\n File "memory:0xb400966cL", line 82, in render_body\n <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.registration_date, date=True)|entity}</div>\n File "/home/elbati/workspace/openerp/7.0/server/openerp/osv/orm.py", line 486, in __getattr__\n raise AttributeError(e)\nAttributeError: "Field \'registration_date\' does not exist in object \'browse_record(account.invoice, 1)\'"\n')
Traceback (most recent call last):
  File "/home/elbati/workspace/openerp/7.0/server/openerp/service/web_services.py", line 712, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/elbati/workspace/openerp/7.0/addons/report_webkit/webkit_report.py", line 333, in create
    result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
  File "/home/elbati/workspace/openerp/7.0/server/openerp/report/report_sxw.py", line 513, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/home/elbati/workspace/openerp/7.0/addons/report_we...

Read more...

review: Needs Fixing
Revision history for this message
Sergio Corato (icsergio) wrote :
Download full text (8.5 KiB)

l'ho caricata in un branch nel mio utente, poi dovevo fare il merge
proposal, ma sono andato a letto :)
tanto non ho cambiato niente, funziona così com'era per la 6.1

2013/4/9 Lorenzo Battistini - Agile BG <email address hidden>

> Review: Needs Fixing
>
> Ho installato il modulo su un nuovo db e stampando ottengo
>
> 2013-04-09 10:26:31,330 12946 ERROR test_70
> openerp.addons.report_webkit.webkit_report:
>
> Traceback (most recent call last):
> File
> "/home/elbati/workspace/openerp/7.0/addons/report_webkit/webkit_report.py",
> line 266, in create_single_pdf
> **self.parser_instance.localcontext)
> File "/usr/lib/python2.7/dist-packages/mako/template.py", line 412, in
> render
> return runtime._render(self, self.callable_, args, data)
> File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 766, in
> _render
> **_kwargs_for_callable(callable_, data))
> File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 798, in
> _render_context
> _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
> File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 824, in
> _exec_template
> callable_(context, *args, **kwargs)
> File "memory:0xb400966cL", line 82, in render_body
> <div class="act_as_cell " style="width:
> 30px;">${formatLang(line.invoice_id.registration_date,
> date=True)|entity}</div>
> File "/home/elbati/workspace/openerp/7.0/server/openerp/osv/orm.py",
> line 486, in __getattr__
> raise AttributeError(e)
> AttributeError: "Field 'registration_date' does not exist in object
> 'browse_record(account.invoice, 1)'"
>
> 2013-04-09 10:26:31,332 12946 ERROR test_70 openerp.service.web_services:
> Exception: (u'Webkit render!', u'\n\nTraceback (most recent call last):\n
> File
> "/home/elbati/workspace/openerp/7.0/addons/report_webkit/webkit_report.py",
> line 266, in create_single_pdf\n **self.parser_instance.localcontext)\n
> File "/usr/lib/python2.7/dist-packages/mako/template.py", line 412, in
> render\n return runtime._render(self, self.callable_, args, data)\n
> File "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 766, in
> _render\n **_kwargs_for_callable(callable_, data))\n File
> "/usr/lib/python2.7/dist-packages/mako/runtime.py", line 798, in
> _render_context\n _exec_template(inherit, lclcontext, args=args,
> kwargs=kwargs)\n File "/usr/lib/python2.7/dist-packages/mako/runtime.py",
> line 824, in _exec_template\n callable_(context, *args, **kwargs)\n
> File "memory:0xb400966cL", line 82, in render_body\n <div
> class="act_as_cell " style="width:
> 30px;">${formatLang(line.invoice_id.registration_date,
> date=True)|entity}</div>\n File
> "/home/elbati/workspace/openerp/7.0/server/openerp/osv/orm.py", line 486,
> in __getattr__\n raise AttributeError(e)\nAttributeError: "Field
> \'registration_date\' does not exist in object
> \'browse_record(account.invoice, 1)\'"\n')
> Traceback (most recent call last):
> File
> "/home/elbati/workspace/openerp/7.0/server/openerp/service/web_services.py",
> line 712, in go
> (result, format) = obj.create(cr, uid, ids, datas, context)
> File
> "/home/elbati/workspace/openerp/7.0/addo...

Read more...

210. By Sergio Corato

[IMP] merged elbati improvements

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

Stavo guardando la query che recupera le righe da stampare:

'SELECT ait.id FROM account_invoice_tax ait, account_invoice ai, account_tax_code atc WHERE (atc.id=ait.tax_code_id AND ai.id=ait.invoice_id AND ai.state IN %s AND ai.period_id IN %s AND ai.journal_id IN %s ) ORDER BY ai.number' , (tuple(invoice_state), tuple(period_id), tuple(journal_id) )

In questo modo però vengono stampate solo le righe generate da fatture. Se l'utente facesse registrazioni dirette sui sezionali di vendita o acquisto, ad esempio tramite causale, queste non verrebbero stampate.

L'approccio "basato sulle fatture" lo avevo seguito anch'io nelle prime versioni di 'l10n_it_vat_registries'. Ma poi spesso ai clienti capitava di fare registrazioni legate all'IVA direttamente in contabilità, ad esempio per il reverse charge o anche per le fatture passive.

Probabilmente modificare 'account_vat_registries_webkit' in modo da non usare 'account_invoice_tax' potrebbe essere oneroso.
A questo punto, almeno per la 7, punterei a correggere i bachi di 'l10n_it_vat_registries'.

Revision history for this message
Sergio Corato (icsergio) wrote :

Da contabile (in questo caso prevale :) ) dico che dovrebbe essere ELIMINATA la possibilità di registrare movimenti con IVA fuori dalle maschere definite appositamente, risolvendo il problema alla radice.

Registrare un movimento con IVA direttamente sul sezionale mi fa rizzare i (pochi) capelli che ho in testa, non credo ci si dovrebbe adeguare ad un comportamento simile (va bè essere aperti, ma si deve fare almeno un po' di cultura elementare contabile).

Questo per fatture acquisto e vendita, non ho avuto l'occasione di provare corrispettivi e altro, ma finora non se ne è parlato.

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

Aggiungo 'OpenERP Italia core devs' ai reviewers.

> Da contabile (in questo caso prevale :) ) dico che dovrebbe essere ELIMINATA la possibilità di registrare movimenti con IVA fuori dalle maschere definite appositamente, risolvendo il problema alla radice.

Intendi dalle fatture?
OpenERP di per sé prevede la possibilità
<http://bazaar.launchpad.net/%7Eopenerp/openobject-addons/7.0/view/9079/account/account_move_line.py#L1227>
di registrare movimenti con IVA direttamente tramite journal entries.
Anche tramite vouchers.
Noi potremmo anche impedire all'utente di registrare movimenti con IVA
al di fuori delle fatture, ma siamo sicuri che non sia troppo stretto
come vincolo?
Ad esempio per chi fa scontrini
<http://planet.domsense.com/2011/11/openerp-registrare-i-corrispettivi/>
o usa il POS?

Revision history for this message
Alessandro Camilli (a-camilli) wrote :

Come accennava Lorenzo, il reverse charge(ma anche le fatture CEE) se non sbaglio implica registrazioni di pura iva.
Se così fosse, eliminare questa possibilità è troppo limitativo.
Sarebbe fantastico comunque creare un modulo che trattandosi di registrazione CEE(o con reverse charge) generi automaticamente la registrazione di sola IVA evitando di farci mettere le mani all'utente.

Revision history for this message
Sergio Corato (icsergio) wrote :

dicevo appunto delle fatture, restando esclusi corrispettivi (che però ho
visto che per chi non fa scontrini si registrano sempre come fatture), in
pratica quindi solo gli scontrini: non sarebbe pensabile registrarli
sull'oggetto account.invoice?

Invece fatture CEE e reverse charge è normale registrarle nello stesso
oggetto, non ho guardato come si fanno ora in oe e se manca il codice IVA
apposito

Il giorno 26 aprile 2013 09:23, Alessandro Camilli <email address hidden> ha
scritto:

> Come accennava Lorenzo, il reverse charge(ma anche le fatture CEE) se non
> sbaglio implica registrazioni di pura iva.
> Se così fosse, eliminare questa possibilità è troppo limitativo.
> Sarebbe fantastico comunque creare un modulo che trattandosi di
> registrazione CEE(o con reverse charge) generi automaticamente la
> registrazione di sola IVA evitando di farci mettere le mani all'utente.
> --
>
> https://code.launchpad.net/~icsergio/openobject-italia/remake-vat-registries/+merge/152598
> You are the owner of lp:~icsergio/openobject-italia/remake-vat-registries.
>

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

Ciao,

sulla base delle recenti proposte di merge e relative discussioni,
abbiamo fatto le seguenti considerazioni:

 1. L'approccio suggerito da xergio è il più corretto. Ovvero dobbiamo
    lasciare a OpenERP il compito di fare tutti i calcoli, visto che i
    tax codes sono stati pensati proprio per questo ed i dati nel
    sistema ci sono già tutti.
 2. Se le registrazioni contabili ed i relativi conti imposta sono
    corretti, allora i registri IVA non devono fare altro che rispecchiarli.
 3. Ci sono casi in cui un movimento di IVA può non essere legato ad una
    fattura, vedi alcuni modi di registrare i corrispettivi o
    l'inversione contabile tramite integrazione
    <http://www.studiomosca.net/index.php?option=com_content&view=article&id=296:inversione-contabile-autofattura-o-integrazione&catid=3:news&Itemid=11>.

Sulla base di ciò, ho sviluppato una versione semplificata dei registri
IVA, sempre basata sui movimenti contabili, ma che si limita solamente a
stampare informazioni già presenti nel sistema.
Se volete testarla, qui c'è il merge proposal
<https://code.launchpad.net/%7Eelbati/openobject-italia/7-l10n_it_vat_registries_simplified/+merge/162188>.

Unmerged revisions

210. By Sergio Corato

[IMP] merged elbati improvements

209. By Sergio Corato

[ADD] some missing fields

208. By Sergio Corato

[IMP] Added fiscal number print in the footer

207. By Sergio Corato

[FIX] renamed module and row separator implementation

206. By Sergio Corato

[ADD] vatregistriese_webkit

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_vat_registries_webkit'
2=== added file 'account_vat_registries_webkit/__init__.py'
3--- account_vat_registries_webkit/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_vat_registries_webkit/__init__.py 2013-04-21 20:48:29 +0000
5@@ -0,0 +1,24 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Nicolas Bessi. Copyright Camptocamp SA
10+# Copyright (C) 2013 Associazione OpenERP Italia
11+# (<http://www.openerp-italia.org>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+import account
28+from . import wizard
29+from . import report
30
31=== added file 'account_vat_registries_webkit/__openerp__.py'
32--- account_vat_registries_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ account_vat_registries_webkit/__openerp__.py 2013-04-21 20:48:29 +0000
34@@ -0,0 +1,51 @@
35+# -*- coding: utf-8 -*-
36+##############################################################################
37+#
38+# Authors: Nicolas Bessi, Guewen Baconnier
39+# Copyright Camptocamp SA 2011
40+# (c) 2013 Sergio Corato
41+# Copyright (C) 2013 Associazione OpenERP Italia
42+# (<http://www.openerp-italia.org>).
43+#
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU Affero General Public License as
46+# published by the Free Software Foundation, either version 3 of the
47+# License, or (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU Affero General Public License for more details.
53+#
54+# You should have received a copy of the GNU Affero General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+#
57+##############################################################################
58+{
59+ 'name': 'VAT Registries - Webkit',
60+ 'description': """
61+VAT Registries - Webkit
62+==========================
63+
64+This module adds the following standard OpenERP financial reports:
65+- VAT Journal
66+
67+""",
68+ 'version': '1.0',
69+ 'author': 'Sergio Corato',
70+ 'license': 'AGPL-3',
71+ 'category': 'Finance',
72+ 'website': 'http://www.icstools.it',
73+ 'images': [],
74+ 'depends': ['account',
75+ 'report_webkit'],
76+ 'demo' : [],
77+ 'data': ['data/financial_webkit_header.xml',
78+ 'report/report.xml',
79+ 'wizard/vatregistries_wizard_view.xml',
80+ 'report_menus.xml',
81+ ],
82+ 'active': False,
83+ 'installable': True,
84+ 'application': True,
85+}
86
87=== added directory 'account_vat_registries_webkit/data'
88=== added file 'account_vat_registries_webkit/data/financial_webkit_header.xml'
89--- account_vat_registries_webkit/data/financial_webkit_header.xml 1970-01-01 00:00:00 +0000
90+++ account_vat_registries_webkit/data/financial_webkit_header.xml 2013-04-21 20:48:29 +0000
91@@ -0,0 +1,413 @@
92+<?xml version="1.0" ?>
93+<openerp>
94+ <data noupdate="1">
95+ <record id="financial_landscape_header" model="ir.header_webkit">
96+ <field name="footer_html"><![CDATA[
97+<html>
98+ <head>
99+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
100+ <script>
101+ function subst() {
102+ var vars={};
103+ var x=document.location.search.substring(1).split('&');
104+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
105+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
106+ for(var i in x) {
107+ var y = document.getElementsByClassName(x[i]);
108+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
109+ }
110+ }
111+ </script>
112+ </head>
113+ <% import datetime %>
114+ <body style="border:0; margin: 0;" onload="subst()">
115+ <table style="border-top: 1px solid black; width: 1080px">
116+ <tr style="border-collapse:collapse;">
117+ <td style="text-align:left;font-size:10;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
118+ <td style="text-align:center;font-size:10;width:350px;">${user.name}</td>
119+ <td style="text-align:right;font-size:10;width:350px;">Page&nbsp;<span class="page"/></td>
120+ <td style="text-align:left;font-size:10;width:30px">&nbsp;of&nbsp;<span class="topage"/></td>
121+ </tr>
122+ </table>
123+ </body>
124+</html>]]></field>
125+ <field name="orientation">Landscape</field>
126+ <field name="format">A4</field>
127+ <field name="html"><![CDATA[
128+<html>
129+ <head>
130+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
131+ <script>
132+ function subst() {
133+ var vars={};
134+ var x=document.location.search.substring(1).split('&');
135+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
136+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
137+ for(var i in x) {
138+ var y = document.getElementsByClassName(x[i]);
139+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
140+ }
141+ }
142+ </script>
143+ <style type="text/css">
144+ ${css}
145+ </style>
146+ </head>
147+ <body style="border:0; margin: 0;" onload="subst()">
148+ <table class="header" style="border-bottom: 0px solid black; width: 100%">
149+ <tr>
150+ <td style="text-align:left; font-size:11px; font-weight: bold;"><span style="text-transform:uppercase; font-size:12px;">${report_name}</span> - ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</td>
151+ </tr>
152+ </table> ${_debug or ''|n} </body>
153+</html>]]>
154+ </field>
155+ <field eval="0.0" name="margin_top"/>
156+ <field name="css"><![CDATA[
157+
158+body, table, td, span, div {
159+ font-family: Helvetica, Arial;
160+}
161+
162+.act_as_table {
163+ display: table;
164+}
165+.act_as_row {
166+ display: table-row;
167+}
168+.act_as_cell {
169+ display: table-cell;
170+}
171+.act_as_thead {
172+ display: table-header-group;
173+}
174+.act_as_tbody {
175+ display: table-row-group;
176+}
177+.act_as_tfoot {
178+ display: table-footer-group;
179+}
180+.act_as_caption {
181+ display: table-caption;
182+}
183+act_as_colgroup {
184+ display: table-column-group;
185+}
186+
187+.list_table, .data_table {
188+ width: 1080px;
189+ table-layout: fixed
190+}
191+
192+.bg, .act_as_row.labels {
193+ background-color:#F0F0F0;
194+}
195+
196+.list_table, .data_table, .list_table .act_as_row {
197+ border-left:0px;
198+ border-right:0px;
199+ text-align:left;
200+ font-size:9px;
201+ padding-right:3px;
202+ padding-left:3px;
203+ padding-top:2px;
204+ padding-bottom:2px;
205+ border-collapse:collapse;
206+}
207+
208+.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines {
209+ border-color:gray;
210+ border-bottom:1px solid lightGrey;
211+}
212+
213+.data_table .act_as_cell {
214+ border: 1px solid lightGrey;
215+ text-align: center;
216+}
217+
218+.data_table .act_as_cell, .list_table .act_as_cell {
219+ word-wrap: break-word;
220+}
221+
222+.data_table .act_as_row.labels {
223+ font-weight: bold;
224+}
225+
226+.initial_balance .act_as_cell {
227+ font-style:italic;
228+}
229+
230+.account_title {
231+ font-size:10px;
232+ font-weight:bold;
233+ page-break-after: avoid;
234+}
235+
236+.act_as_cell.amount {
237+ word-wrap:normal;
238+ text-align:right;
239+}
240+
241+.list_table .act_as_cell{
242+ padding-left: 5px;
243+/* border-right:1px solid lightGrey; uncomment to active column lines */
244+}
245+.list_table .act_as_cell.first_column {
246+ padding-left: 0px;
247+/* border-left:1px solid lightGrey; uncomment to active column lines */
248+}
249+
250+.sep_left {
251+ border-left: 1px solid lightGrey;
252+}
253+
254+.overflow_ellipsis {
255+ text-overflow: ellipsis;
256+ overflow: hidden;
257+ white-space: nowrap;
258+}
259+
260+.open_invoice_previous_line {
261+ font-style: italic;
262+}
263+
264+.clearance_line {
265+ font-style: italic;
266+}
267+
268+]]>
269+ </field>
270+ <field name="name">Financial Landscape Header</field>
271+ </record>
272+
273+ <record id="VAT_portrait_header" model="ir.header_webkit">
274+ <field name="footer_html"><![CDATA[
275+<html>
276+ <head>
277+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
278+ <script>
279+ function subst() {
280+ var vars={};
281+ var x=document.location.search.substring(1).split('&');
282+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
283+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
284+ for(var i in x) {
285+ var y = document.getElementsByClassName(x[i]);
286+ for(var j=0; j<y.length; ++j) {
287+ if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};}
288+ else{y[j].textContent = vars[x[i]];}
289+ }
290+
291+ }
292+ }
293+ </script>
294+ </head>
295+ <% import datetime %>
296+ <body style="border:0; margin: 0;" onload="subst()">
297+ <table style="border-top: 1px solid black; width: 1080px">
298+ <tr style="border-collapse:collapse;">
299+ <td style="text-align:left;font-size:10;width:350px;"></td>
300+ <td style="text-align:center;font-size:10;width:350px;"></td>
301+ <td style="text-align:right;font-size:10;width:350px;">Page&nbsp;<span class="page"/></td>
302+ <td style="text-align:left;font-size:10;width:30px">&nbsp;/&nbsp;${f_y}</td>
303+ </tr>
304+ </table>
305+ </body>
306+</html>]]></field>
307+ <field name="orientation">Portrait</field>
308+ <field name="format">A4</field>
309+ <field name="html"><![CDATA[
310+<html>
311+ <head>
312+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
313+ <script>
314+ function subst() {
315+ var vars={};
316+ var x=document.location.search.substring(1).split('&');
317+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
318+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
319+ for(var i in x) {
320+ var y = document.getElementsByClassName(x[i]);
321+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
322+ }
323+ }
324+ </script>
325+ <style type="text/css">
326+ ${css}
327+ </style>
328+ </head>
329+ <body style="border:0; margin: 0;" onload="subst()">
330+ <table class="header" style="border-bottom: 0px solid black; width: 100%">
331+ <tr>
332+ <td style="text-align:left; font-size:11px; font-weight: bold;"><span style="text-transform:uppercase; font-size:12px;">${report_name}</span> - ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</td>
333+ </tr>
334+ </table> ${_debug or ''|n} </body>
335+</html>]]>
336+ </field>
337+ <field eval="17.0" name="margin_top"/>
338+ <field eval="15.0" name="margin_bottom"/>
339+ <field name="css"><![CDATA[
340+
341+body, table, td, span, div {
342+ font-family: Helvetica, Arial;
343+}
344+
345+.act_as_table {
346+ display: table;
347+}
348+.act_as_row {
349+ display: table-row;
350+}
351+.act_as_cell {
352+ display: table-cell;
353+}
354+.act_as_thead {
355+ display: table-header-group;
356+}
357+.act_as_tbody {
358+ display: table-row-group;
359+}
360+.act_as_tfoot {
361+ display: table-footer-group;
362+}
363+.act_as_caption {
364+ display: table-caption;
365+}
366+act_as_colgroup {
367+ display: table-column-group;
368+}
369+
370+.list_table, .data_table {
371+ width: 690px;
372+ table-layout: fixed
373+}
374+
375+.bg, .act_as_row.labels {
376+ background-color:#F0F0F0;
377+}
378+
379+.list_table, .data_table, .list_table .act_as_row {
380+ border-left:0px;
381+ border-right:0px;
382+ text-align:left;
383+ font-size:9px;
384+ padding-right:3px;
385+ padding-left:3px;
386+ padding-top:2px;
387+ padding-bottom:2px;
388+ border-collapse:collapse;
389+}
390+
391+.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines {
392+ border-color:gray;
393+ border-bottom:1px solid lightGrey;
394+}
395+
396+.data_table .act_as_cell {
397+ border: 1px solid lightGrey;
398+ text-align: center;
399+}
400+
401+.data_table .act_as_cell, .list_table .act_as_cell {
402+ word-wrap: break-word;
403+}
404+
405+.data_table .act_as_row.labels {
406+ font-weight: bold;
407+}
408+
409+.initial_balance .act_as_cell {
410+ font-style:italic;
411+}
412+
413+.account_title {
414+ font-size:10px;
415+ font-weight:bold;
416+ page-break-after: avoid;
417+}
418+
419+.act_as_cell.amount {
420+ word-wrap:normal;
421+ text-align:right;
422+}
423+
424+.list_table .act_as_cell{
425+ padding-left: 5px;
426+/* border-right:1px solid lightGrey; uncomment to active column lines */
427+}
428+.list_table .act_as_cell.first_column {
429+ padding-left: 0px;
430+/* border-left:1px solid lightGrey; uncomment to active column lines */
431+}
432+
433+.sep_left {
434+ border-left: 1px solid lightGrey;
435+}
436+
437+.account_level_1 {
438+ text-transform: uppercase;
439+ /*font-weight: bold;*/
440+ font-size: 15px;
441+ background-color:#F0F0F0;
442+}
443+
444+/*
445+.account_level_1 .act_as_cell {
446+ height: 30px;
447+ vertical-align: bottom;
448+}
449+*/
450+
451+.account_level_2 {
452+ /*text-transform: uppercase;
453+ font-weight: bold;*/
454+ font-size: 12px;
455+ background-color:#F0F0F0;
456+}
457+
458+/*
459+.account_level_2 .act_as_cell {
460+ height: 20px;
461+ vertical-align: bottom;
462+}
463+
464+.account_level_3 {
465+ text-transform: uppercase;
466+ font-weight: bold;
467+ font-size: 11px;
468+ background-color:#FAFAFA;
469+}
470+
471+.account_level_4 {
472+ font-weight: bold;
473+ font-size: 11px;
474+}
475+*/
476+
477+.account_level_5 {
478+
479+}
480+
481+.regular_account_type {
482+ font-weight: normal;
483+}
484+
485+.view_account_type {
486+ font-weight: bold;
487+
488+.account_level_consol {
489+ font-weight: normal;
490+ font-style: italic;
491+}
492+
493+.overflow_ellipsis {
494+ text-overflow: ellipsis;
495+ overflow: hidden;
496+ white-space: nowrap;
497+}
498+
499+]]>
500+ </field>
501+ <field name="name">Financial Portrait Header</field>
502+ </record>
503+ </data>
504+</openerp>
505
506=== added directory 'account_vat_registries_webkit/i18n'
507=== added directory 'account_vat_registries_webkit/report'
508=== added file 'account_vat_registries_webkit/report/__init__.py'
509--- account_vat_registries_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
510+++ account_vat_registries_webkit/report/__init__.py 2013-04-21 20:48:29 +0000
511@@ -0,0 +1,21 @@
512+# -*- coding: utf-8 -*-
513+##############################################################################
514+#
515+# Copyright (C) 2013 Associazione OpenERP Italia
516+# (<http://www.openerp-italia.org>).
517+#
518+# This program is free software: you can redistribute it and/or modify
519+# it under the terms of the GNU Affero General Public License as
520+# published by the Free Software Foundation, either version 3 of the
521+# License, or (at your option) any later version.
522+#
523+# This program is distributed in the hope that it will be useful,
524+# but WITHOUT ANY WARRANTY; without even the implied warranty of
525+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
526+# GNU Affero General Public License for more details.
527+#
528+# You should have received a copy of the GNU Affero General Public License
529+# along with this program. If not, see <http://www.gnu.org/licenses/>.
530+#
531+##############################################################################
532+from . import vat_registries
533
534=== added file 'account_vat_registries_webkit/report/report.xml'
535--- account_vat_registries_webkit/report/report.xml 1970-01-01 00:00:00 +0000
536+++ account_vat_registries_webkit/report/report.xml 2013-04-21 20:48:29 +0000
537@@ -0,0 +1,27 @@
538+<?xml version="1.0" encoding="utf-8"?>
539+<openerp>
540+ <data>
541+
542+ <record id="account_report_vat_registries_webkit" model="ir.actions.report.xml">
543+ <field name="report_type">webkit</field>
544+ <field name="report_name">account.account_report_vat_registries_webkit</field>
545+ <field eval="[(6,0,[])]" name="groups_id"/>
546+ <field eval="0" name="multi"/>
547+ <field eval="0" name="auto"/>
548+ <field eval="1" name="header"/>
549+ <field name="model">account.account</field>
550+ <field name="type">ir.actions.report.xml</field>
551+ <field name="name">VAT Registries Webkit</field>
552+ <field name="report_rml">account_vat_registries_webkit/report/templates/account_report_vat_registries.mako</field>
553+ <field name="report_file">account_vat_registries_webkit/report/templates/account_report_vat_registries.mako</field>
554+ </record>
555+
556+ <record id="property_account_report_vat_registries_webkit" model="ir.property">
557+ <field name="name">account_report_vat_registries_webkit</field>
558+ <field name="fields_id" ref="report_webkit.field_ir_act_report_xml_webkit_header"/>
559+ <field eval="'ir.header_webkit,'+str(ref('account_vat_registries_webkit.VAT_portrait_header'))" model="ir.header_webkit" name="value"/>
560+ <field eval="'ir.actions.report.xml,'+str(ref('account_vat_registries_webkit.account_report_vat_registries_webkit'))" model="ir.actions.report.xml" name="res_id"/>
561+ </record>
562+
563+ </data>
564+</openerp>
565
566=== added directory 'account_vat_registries_webkit/report/templates'
567=== added file 'account_vat_registries_webkit/report/templates/account_report_vat_registries.mako'
568--- account_vat_registries_webkit/report/templates/account_report_vat_registries.mako 1970-01-01 00:00:00 +0000
569+++ account_vat_registries_webkit/report/templates/account_report_vat_registries.mako 2013-04-21 20:48:29 +0000
570@@ -0,0 +1,132 @@
571+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
572+<html xmlns="http://www.w3.org/1999/xhtml">
573+ <head>
574+ <style type="text/css">
575+ ${css}
576+
577+ .list_table .act_as_row {
578+ margin-top: 10px;
579+ margin-bottom: 10px;
580+ font-size:10px;
581+ }
582+
583+ .account_line {
584+ font-weight: bold;
585+ font-size: 15px;
586+ background-color:#F0F0F0;
587+ }
588+
589+ .account_line .act_as_cell {
590+ height: 30px;
591+ vertical-align: bottom;
592+ }
593+
594+ </style>
595+ </head>
596+ <body>
597+ <%setLang(user.lang)%>
598+
599+<!--start header -->
600+ <div class="act_as_table list_table" style="width: 95%;">
601+ <div class="act_as_thead">
602+ <div class="act_as_row labels">
603+ <div class="act_as_cell " style="width: 30px;">${_('Fiscal Year')}</div>
604+ <div class="act_as_cell " style="width: 70px;">${_('Journal')}</div>
605+ <div class="act_as_cell " style="width: 70px;">${_('Journal Type')}</div>
606+ <div class="act_as_cell " style="width: 30px;">${_('Period')}</div>
607+ <!--div class="act_as_cell " style="width: 50px;">${_('Report')}</div-->
608+
609+ </div>
610+ </div>
611+ <div class="act_as_tbody">
612+ %for obj in objects:
613+ <div class="act_as_row lines">
614+ <div class="act_as_cell " style="width: 30px;">${ obj.fiscalyear_id.name}</div>
615+ <div class="act_as_cell " style="width: 70px;">${ obj.journal_id.name}</div>
616+ <div class="act_as_cell " style="width: 70px;">${ obj.journal_id.type}</div>
617+ <div class="act_as_cell " style="width: 30px;">${ obj.period_id.name}</div>
618+ <!--div class="act_as_cell " style="width: 50px;">${ report_name or ''}</div-->
619+
620+ </div>
621+ %endfor
622+ </div>
623+ </div>
624+<!--end header -->
625+
626+<!--start body -->
627+ <div class="act_as_table list_table" style="width: 95%; margin-top: 20px;">
628+ <div class="act_as_thead">
629+ <div class="act_as_row labels">
630+ <div class="act_as_cell first_row" style="width: 30px;">${_('Reg. Date')}</div>
631+ <div class="act_as_cell first_row" style="width: 30px;">${_('Move Date')}</div>
632+ <div class="act_as_cell first_row" style="width: 50px;">${_('Move Ref.')}</div>
633+ <div class="act_as_cell first_row" style="width: 50px;">${_('Invoice Nr')}</div>
634+ <div class="act_as_cell first_row" style="width: 60px;">${_('Partner')}</div>
635+ <div class="act_as_cell first_row" style="width: 30px;">${_('Taxable Amount')}</div>
636+ <div class="act_as_cell first_row" style="width: 30px;">${_('Tax')}</div>
637+ <div class="act_as_cell first_row" style="width: 90px;">${_('Tax Description')}</div>
638+ </div>
639+ </div>
640+ <div class="act_as_tbody">
641+
642+%for obj in objects:
643+<%invoice_n = None%>
644+%for line in lines(obj.period_id.id, obj.journal_id.id):
645+%if line.tax_code_id.id:
646+
647+%if invoice_n != line.invoice_id.number and invoice_n != None:
648+ <div class="act_as_row lines" style="border-top: 2px solid gray;">
649+%else:
650+ <div class="act_as_row lines">
651+%endif
652+ <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.registration_date, date=True)|entity}</div>
653+ <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.date_invoice, date=True)|entity}</div>
654+ <div class="act_as_cell " style="width: 50px;">${ line.invoice_id.number}</div>
655+ <div class="act_as_cell " style="width: 50px;">${ line.invoice_id.supplier_invoice_number or line.invoice_id.number or ''}</div>
656+ <div class="act_as_cell " style="width: 60px;">${ line.invoice_id.partner_id.name}</div>
657+%if line.base_code_id.id:
658+ <div class="act_as_cell amount" style="width: 30px;">${ line.base_amount *-1}</div>
659+%else:
660+ <div class="act_as_cell amount" style="width: 30px;"></div>
661+%endif
662+ <div class="act_as_cell amount" style="width: 30px;">${ line.tax_amount *-1}</div>
663+ <div class="act_as_cell " style="width: 90px;">${ line.tax_code_id.name}</div>
664+ </div>
665+
666+
667+<%invoice_n = line.invoice_id.number%>
668+%endif
669+%endfor
670+%endfor
671+
672+ </div>
673+ </div>
674+<!--end body -->
675+
676+ <div class="act_as_table list_table" style="margin-left: 80px; margin-top: 20px; width: 50%;">
677+ <div class="act_as_thead">
678+ <div class="act_as_row labels">
679+ <div class="act_as_cell first_row" style="width: 80px;">${_('Tax Code')}</div>
680+ <div class="act_as_cell first_row" style="width: 20px;">${_('Base Amount')}</div>
681+ <div class="act_as_cell first_row" style="width: 20px;">${_('Tax Amount')}</div>
682+ </div>
683+ </div>
684+ <div class="act_as_tbody">
685+%for obj in objects:
686+%for obj_t in tax_total(obj.period_id.id, obj.journal_id.id):
687+ <div class="act_as_row lines">
688+ <div class="act_as_cell" style="width: 80px;">${ obj_t[0]}</div>
689+%if not obj_t[4] is None:
690+ <div class="act_as_cell amount" style="width: 20px;">${ obj_t[1] *-1}</div>
691+%else:
692+ <div class="act_as_cell amount" style="width: 20px;"></div>
693+%endif
694+ <div class="act_as_cell amount" style="width: 20px;">${ obj_t[2] *-1}</div>
695+ </div>
696+%endfor
697+%endfor
698+ </div>
699+ </div>
700+
701+ </body>
702+</html>
703
704=== added file 'account_vat_registries_webkit/report/vat_registries.py'
705--- account_vat_registries_webkit/report/vat_registries.py 1970-01-01 00:00:00 +0000
706+++ account_vat_registries_webkit/report/vat_registries.py 2013-04-21 20:48:29 +0000
707@@ -0,0 +1,132 @@
708+# -*- coding: utf-8 -*-
709+##############################################################################
710+#
711+# Author: Guewen Baconnier
712+# Copyright Camptocamp SA 2011
713+# Copyright (C) 2013 Associazione OpenERP Italia
714+# (<http://www.openerp-italia.org>).
715+#
716+# This program is free software: you can redistribute it and/or modify
717+# it under the terms of the GNU Affero General Public License as
718+# published by the Free Software Foundation, either version 3 of the
719+# License, or (at your option) any later version.
720+#
721+# This program is distributed in the hope that it will be useful,
722+# but WITHOUT ANY WARRANTY; without even the implied warranty of
723+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
724+# GNU Affero General Public License for more details.
725+#
726+# You should have received a copy of the GNU Affero General Public License
727+# along with this program. If not, see <http://www.gnu.org/licenses/>.
728+#
729+##############################################################################
730+
731+
732+from datetime import datetime
733+
734+from openerp import pooler
735+from openerp.report import report_sxw
736+from openerp.tools.translate import _
737+
738+class vat_registries_webkit(report_sxw.rml_parse):
739+
740+ def __init__(self, cursor, uid, name, context):
741+ super(vat_registries_webkit, self).__init__(cursor, uid, name, context=context)
742+ self.pool = pooler.get_pool(self.cr.dbname)
743+ self.cursor = self.cr
744+ self.sort_selection = 'am.name'
745+ company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id
746+ header_report_name = ' - '.join((_('VAT REGISTER'), company.name, company.currency_id.name))
747+
748+ footer_date_time = self.formatLang(str(datetime.today()), date_time=True)
749+
750+ self.localcontext.update({
751+ 'cr': cursor,
752+ 'uid': uid,
753+ 'lines': self.tax_lines,
754+ 'tax_total': self.tax_totals,
755+ 'report_name': _('VAT Register'),
756+ })
757+
758+ def _get_target_invoice(self, data):
759+ #import pdb; pdb.set_trace()
760+ if data.get('form', False) and data['form'].get('target_invoice', False):
761+ if data['form']['target_invoice'] == 'all':
762+ return _('All Entries (includes draft)')
763+ return _('All Posted Entries')
764+ return ''
765+
766+ def _get_fiscalyear(self, data):
767+
768+ obj_fy = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, data['form']['fiscalyear_id'])
769+
770+ return obj_fy.name
771+
772+ def set_context(self, objects, data, ids, report_type=None):
773+ new_ids = ids
774+ self.target_invoice = data['form'].get('target_invoice', 'all')
775+ #import pdb; pdb.set_trace()
776+ var = data['form'].get('fiscal_page_base')
777+
778+ fiscalyear = self._get_fiscalyear(data)
779+ self.localcontext.update({
780+ 'f_y': fiscalyear,
781+ 'fiscal_page_base': data['form'].get('fiscal_page_base'),
782+ })
783+ if (data['model'] == 'ir.ui.menu'):
784+ self.period_ids = tuple(data['form']['periods'])
785+ self.journal_ids = tuple(data['form']['journal_ids'])
786+ new_ids = data['form'].get('active_ids', [])
787+ objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
788+ elif new_ids:
789+ #in case of direct access from account.journal.period object, we need to set the journal_ids and periods_ids
790+ self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
791+ res = self.cr.fetchall()
792+ self.period_ids, self.journal_ids = zip(*res)
793+ return super(vat_registries_webkit, self).set_context(objects, data, ids, report_type=report_type)
794+
795+ def tax_lines(self, period_id, journal_id=False):
796+ if not journal_id:
797+ journal_id = self.journal_ids
798+ else:
799+ journal_id = [journal_id]
800+ if not period_id:
801+ period_id = self.period_ids
802+ else:
803+ period_id = [period_id]
804+
805+ obj_tax_lines = self.pool.get('account.invoice.tax')
806+
807+ invoice_state = ['open','paid']
808+ #da implementare se può essere utile avere una stampa con le fatture in bozza
809+ #if self.target_invoice == 'all':
810+ # invoice_state = ['open','paid','draft']
811+ # ext = ' OR ai.period_id IS NULL'
812+
813+ self.cr.execute('SELECT ait.id FROM account_invoice_tax ait, account_invoice ai, account_tax_code atc WHERE (atc.id=ait.tax_code_id AND ai.id=ait.invoice_id AND ai.state IN %s AND ai.period_id IN %s AND ai.journal_id IN %s ) ORDER BY ai.number' , (tuple(invoice_state), tuple(period_id), tuple(journal_id) ))
814+ ids = map(lambda x: x[0], self.cr.fetchall())
815+ return obj_tax_lines.browse(self.cr, self.uid, ids)
816+
817+ def tax_totals(self, period_id, journal_id=False):
818+
819+ if not journal_id:
820+ journal_id = self.journal_ids
821+ else:
822+ journal_id = [journal_id]
823+ if not period_id:
824+ period_id = self.period_ids
825+ else:
826+ period_id = [period_id]
827+
828+ obj_tax = self.pool.get('account.invoice.tax')
829+ invoice_state = ['open','paid']
830+
831+ self.cr.execute('SELECT atc.name, SUM (ait.base_amount) AS base_totals, SUM(ait.tax_amount) AS tax_totals, ait.tax_code_id , ait.base_code_id FROM account_invoice_tax ait, account_invoice ai, account_tax_code atc WHERE atc.id=ait.tax_code_id AND ai.id=ait.invoice_id AND ai.state IN %s AND ai.period_id IN %s AND ai.journal_id IN %s GROUP BY atc.name, ait.base_code_id, ait.tax_code_id ORDER BY atc.name', (tuple(invoice_state), tuple(period_id), tuple(journal_id) ))
832+ #ids = map(lambda x: x[0], self.cr.fetchall())
833+ #return obj_mline_t.browse(self.cr, self.uid, ids)
834+ return self.cr.fetchall()
835+
836+report_sxw.report_sxw('report.account.account_report_vat_registries_webkit',
837+ 'account.account',
838+ 'addons/account_vat_registries_webkit/report/templates/account_report_vat_registries.mako',
839+ parser=vat_registries_webkit)
840
841=== added file 'account_vat_registries_webkit/report_menus.xml'
842--- account_vat_registries_webkit/report_menus.xml 1970-01-01 00:00:00 +0000
843+++ account_vat_registries_webkit/report_menus.xml 2013-04-21 20:48:29 +0000
844@@ -0,0 +1,11 @@
845+<?xml version="1.0" encoding="utf-8"?>
846+<openerp>
847+ <data>
848+
849+
850+ <menuitem icon="STOCK_PRINT" name="VAT Registries"
851+ parent="account.next_id_22" action="action_account_print_vat_registries_webkit"
852+ groups="account.group_account_manager,account.group_account_user" id="account.menu_account_vat_registries_report"/>
853+
854+ </data>
855+</openerp>
856
857=== added directory 'account_vat_registries_webkit/wizard'
858=== added file 'account_vat_registries_webkit/wizard/__init__.py'
859--- account_vat_registries_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
860+++ account_vat_registries_webkit/wizard/__init__.py 2013-04-21 20:48:29 +0000
861@@ -0,0 +1,23 @@
862+# -*- coding: utf-8 -*-
863+##############################################################################
864+#
865+# (c)2013 Sergio Corato
866+# Copyright (C) 2013 Associazione OpenERP Italia
867+# (<http://www.openerp-italia.org>).
868+#
869+# This program is free software: you can redistribute it and/or modify
870+# it under the terms of the GNU Affero General Public License as
871+# published by the Free Software Foundation, either version 3 of the
872+# License, or (at your option) any later version.
873+#
874+# This program is distributed in the hope that it will be useful,
875+# but WITHOUT ANY WARRANTY; without even the implied warranty of
876+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
877+# GNU Affero General Public License for more details.
878+#
879+# You should have received a copy of the GNU Affero General Public License
880+# along with this program. If not, see <http://www.gnu.org/licenses/>.
881+#
882+##############################################################################
883+
884+from . import vatregistries_wizard
885
886=== added file 'account_vat_registries_webkit/wizard/vatregistries_wizard.py'
887--- account_vat_registries_webkit/wizard/vatregistries_wizard.py 1970-01-01 00:00:00 +0000
888+++ account_vat_registries_webkit/wizard/vatregistries_wizard.py 2013-04-21 20:48:29 +0000
889@@ -0,0 +1,60 @@
890+# -*- coding: utf-8 -*-
891+##############################################################################
892+#
893+# Author: Guewen Baconnier
894+# Copyright Camptocamp SA 2011
895+# Copyright (C) 2013 Associazione OpenERP Italia
896+# (<http://www.openerp-italia.org>).
897+#
898+# This program is free software: you can redistribute it and/or modify
899+# it under the terms of the GNU Affero General Public License as
900+# published by the Free Software Foundation, either version 3 of the
901+# License, or (at your option) any later version.
902+#
903+# This program is distributed in the hope that it will be useful,
904+# but WITHOUT ANY WARRANTY; without even the implied warranty of
905+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
906+# GNU Affero General Public License for more details.
907+#
908+# You should have received a copy of the GNU Affero General Public License
909+# along with this program. If not, see <http://www.gnu.org/licenses/>.
910+#
911+##############################################################################
912+
913+from openerp.osv import fields, orm
914+
915+class account_print_vat_registries(orm.TransientModel):
916+ _inherit = "account.common.journal.report"
917+ _name = 'account.print.vat_registries'
918+ _description = 'Account Print VAT Registries'
919+
920+ _columns = {
921+ 'sort_selection': fields.selection([('l.date', 'Date'),
922+ ('am.name', 'Journal Entry Number'),],
923+ 'Entries Sorted by', required=True),
924+ 'journal_ids': fields.many2many('account.journal',
925+ 'account_print_journal_vat_registries_rel', 'account_id',
926+ 'journal_id', 'Journals', required=True),
927+ 'target_invoice': fields.selection([('posted', 'All Posted Entries'),
928+ ('all', 'All Entries (includes draft)'),
929+ ], 'Target Invoices', required=True),
930+ 'fiscal_page_base': fields.integer('Last page printed', required=True),
931+ }
932+
933+ _defaults = {
934+ 'sort_selection': 'am.name',
935+ 'filter': 'filter_period',
936+ 'journal_ids': False,
937+ 'target_invoice': 'posted',
938+ 'fiscal_page_base': 0,
939+ }
940+
941+ def _print_report(self, cr, uid, ids, data, context=None):
942+ # we update form with display account value
943+ data = self.pre_print_report(cr, uid, ids, data, context=context)
944+ data['form']['fiscal_page_base'] = self.browse(cr, uid, ids, context=context)[0].fiscal_page_base
945+
946+ return {'type': 'ir.actions.report.xml',
947+ 'report_name': 'account.account_report_vat_registries_webkit',
948+ 'datas': data}
949+
950
951=== added file 'account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml'
952--- account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml 1970-01-01 00:00:00 +0000
953+++ account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml 2013-04-21 20:48:29 +0000
954@@ -0,0 +1,49 @@
955+<?xml version="1.0" encoding="utf-8"?>
956+<openerp>
957+ <data>
958+
959+ <record id="account_report_print_vat_registries" model="ir.ui.view">
960+ <field name="name">Account Print VAT Registries</field>
961+ <field name="model">account.print.vat_registries</field>
962+ <field name="inherit_id" ref="account.account_common_report_view" />
963+ <field name="arch" type="xml">
964+ <data>
965+ <xpath expr="//field[@name='target_move']" position="replace">
966+ <!--field name="target_invoice"/-->
967+ <!--field name="amount_currency"/-->
968+ <field name="fiscal_page_base"/>
969+ <newline/>
970+ <field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" colspan="4" invisible="1"/>
971+ <separator string="Periods" colspan="4"/>
972+ <field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/>
973+ <field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/>
974+ <separator string="Journals" colspan="4"/>
975+ <field name="journal_ids" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]" colspan="4" nolabel="1"/>
976+ </xpath>
977+ <xpath expr="//page[@name='filters']" position="replace">
978+ </xpath>
979+ <xpath expr="//page[@name='journal_ids']" position="replace">
980+ </xpath>
981+ </data>
982+ </field>
983+ </record>
984+
985+ <record id="action_account_print_vat_registries_webkit" model="ir.actions.act_window">
986+ <field name="name">Print VAT Journal</field>
987+ <field name="type">ir.actions.act_window</field>
988+ <field name="res_model">account.print.vat_registries</field>
989+ <field name="view_type">form</field>
990+ <field name="view_mode">form</field>
991+ <field name="target">new</field>
992+ <field name="view_id" ref="account_report_print_vat_registries"/>
993+ </record>
994+ <menuitem
995+ name="VAT Journals"
996+ parent="account.menu_journals_report"
997+ action="action_account_print_vat_registries_webkit"
998+ id="menu_account_print_vat_registries"
999+ icon="STOCK_PRINT"
1000+ sequence="1"/>
1001+
1002+ </data>
1003+</openerp>

Subscribers

People subscribed via source and target branches