You have been requested to review the proposed merge of lp:~icsergio/openobject-italia/remake-vat-registries into lp:openobject-italia/7.0.
For more details, see: https://code.launchpad.net/~icsergio/openobject-italia/remake-vat-registries/+merge/152598 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. -- https://code.launchpad.net/~icsergio/openobject-italia/remake-vat-registries/+merge/152598 Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~icsergio/openobject-italia/remake-vat-registries into lp:openobject-italia/7.0.
=== added directory 'account_vat_registries_webkit' === added file 'account_vat_registries_webkit/__init__.py' --- account_vat_registries_webkit/__init__.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/__init__.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi. Copyright Camptocamp SA +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## +import account +from . import wizard +from . import report === added file 'account_vat_registries_webkit/__openerp__.py' --- account_vat_registries_webkit/__openerp__.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/__openerp__.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Authors: Nicolas Bessi, Guewen Baconnier +# Copyright Camptocamp SA 2011 +# (c) 2013 Sergio Corato +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## +{ + 'name': 'VAT Registries - Webkit', + 'description': """ +VAT Registries - Webkit +========================== + +This module adds the following standard OpenERP financial reports: +- VAT Journal + +""", + 'version': '1.0', + 'author': 'Sergio Corato', + 'license': 'AGPL-3', + 'category': 'Finance', + 'website': 'http://www.icstools.it', + 'images': [], + 'depends': ['account', + 'report_webkit'], + 'demo' : [], + 'data': ['data/financial_webkit_header.xml', + 'report/report.xml', + 'wizard/vatregistries_wizard_view.xml', + 'report_menus.xml', + ], + 'active': False, + 'installable': True, + 'application': True, +} === added directory 'account_vat_registries_webkit/data' === added file 'account_vat_registries_webkit/data/financial_webkit_header.xml' --- account_vat_registries_webkit/data/financial_webkit_header.xml 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/data/financial_webkit_header.xml 2013-04-21 20:48:29 +0000 @@ -0,0 +1,413 @@ +<?xml version="1.0" ?> +<openerp> + <data noupdate="1"> + <record id="financial_landscape_header" model="ir.header_webkit"> + <field name="footer_html"><![CDATA[ +<html> + <head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; + } + } + </script> + </head> + <% import datetime %> + <body style="border:0; margin: 0;" onload="subst()"> + <table style="border-top: 1px solid black; width: 1080px"> + <tr style="border-collapse:collapse;"> + <td style="text-align:left;font-size:10;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td> + <td style="text-align:center;font-size:10;width:350px;">${user.name}</td> + <td style="text-align:right;font-size:10;width:350px;">Page <span class="page"/></td> + <td style="text-align:left;font-size:10;width:30px"> of <span class="topage"/></td> + </tr> + </table> + </body> +</html>]]></field> + <field name="orientation">Landscape</field> + <field name="format">A4</field> + <field name="html"><![CDATA[ +<html> + <head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; + } + } + </script> + <style type="text/css"> + ${css} + </style> + </head> + <body style="border:0; margin: 0;" onload="subst()"> + <table class="header" style="border-bottom: 0px solid black; width: 100%"> + <tr> + <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> + </tr> + </table> ${_debug or ''|n} </body> +</html>]]> + </field> + <field eval="0.0" name="margin_top"/> + <field name="css"><![CDATA[ + +body, table, td, span, div { + font-family: Helvetica, Arial; +} + +.act_as_table { + display: table; +} +.act_as_row { + display: table-row; +} +.act_as_cell { + display: table-cell; +} +.act_as_thead { + display: table-header-group; +} +.act_as_tbody { + display: table-row-group; +} +.act_as_tfoot { + display: table-footer-group; +} +.act_as_caption { + display: table-caption; +} +act_as_colgroup { + display: table-column-group; +} + +.list_table, .data_table { + width: 1080px; + table-layout: fixed +} + +.bg, .act_as_row.labels { + background-color:#F0F0F0; +} + +.list_table, .data_table, .list_table .act_as_row { + border-left:0px; + border-right:0px; + text-align:left; + font-size:9px; + padding-right:3px; + padding-left:3px; + padding-top:2px; + padding-bottom:2px; + border-collapse:collapse; +} + +.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines { + border-color:gray; + border-bottom:1px solid lightGrey; +} + +.data_table .act_as_cell { + border: 1px solid lightGrey; + text-align: center; +} + +.data_table .act_as_cell, .list_table .act_as_cell { + word-wrap: break-word; +} + +.data_table .act_as_row.labels { + font-weight: bold; +} + +.initial_balance .act_as_cell { + font-style:italic; +} + +.account_title { + font-size:10px; + font-weight:bold; + page-break-after: avoid; +} + +.act_as_cell.amount { + word-wrap:normal; + text-align:right; +} + +.list_table .act_as_cell{ + padding-left: 5px; +/* border-right:1px solid lightGrey; uncomment to active column lines */ +} +.list_table .act_as_cell.first_column { + padding-left: 0px; +/* border-left:1px solid lightGrey; uncomment to active column lines */ +} + +.sep_left { + border-left: 1px solid lightGrey; +} + +.overflow_ellipsis { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.open_invoice_previous_line { + font-style: italic; +} + +.clearance_line { + font-style: italic; +} + +]]> + </field> + <field name="name">Financial Landscape Header</field> + </record> + + <record id="VAT_portrait_header" model="ir.header_webkit"> + <field name="footer_html"><![CDATA[ +<html> + <head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) { + if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} + else{y[j].textContent = vars[x[i]];} + } + + } + } + </script> + </head> + <% import datetime %> + <body style="border:0; margin: 0;" onload="subst()"> + <table style="border-top: 1px solid black; width: 1080px"> + <tr style="border-collapse:collapse;"> + <td style="text-align:left;font-size:10;width:350px;"></td> + <td style="text-align:center;font-size:10;width:350px;"></td> + <td style="text-align:right;font-size:10;width:350px;">Page <span class="page"/></td> + <td style="text-align:left;font-size:10;width:30px"> / ${f_y}</td> + </tr> + </table> + </body> +</html>]]></field> + <field name="orientation">Portrait</field> + <field name="format">A4</field> + <field name="html"><![CDATA[ +<html> + <head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; + } + } + </script> + <style type="text/css"> + ${css} + </style> + </head> + <body style="border:0; margin: 0;" onload="subst()"> + <table class="header" style="border-bottom: 0px solid black; width: 100%"> + <tr> + <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> + </tr> + </table> ${_debug or ''|n} </body> +</html>]]> + </field> + <field eval="17.0" name="margin_top"/> + <field eval="15.0" name="margin_bottom"/> + <field name="css"><![CDATA[ + +body, table, td, span, div { + font-family: Helvetica, Arial; +} + +.act_as_table { + display: table; +} +.act_as_row { + display: table-row; +} +.act_as_cell { + display: table-cell; +} +.act_as_thead { + display: table-header-group; +} +.act_as_tbody { + display: table-row-group; +} +.act_as_tfoot { + display: table-footer-group; +} +.act_as_caption { + display: table-caption; +} +act_as_colgroup { + display: table-column-group; +} + +.list_table, .data_table { + width: 690px; + table-layout: fixed +} + +.bg, .act_as_row.labels { + background-color:#F0F0F0; +} + +.list_table, .data_table, .list_table .act_as_row { + border-left:0px; + border-right:0px; + text-align:left; + font-size:9px; + padding-right:3px; + padding-left:3px; + padding-top:2px; + padding-bottom:2px; + border-collapse:collapse; +} + +.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines { + border-color:gray; + border-bottom:1px solid lightGrey; +} + +.data_table .act_as_cell { + border: 1px solid lightGrey; + text-align: center; +} + +.data_table .act_as_cell, .list_table .act_as_cell { + word-wrap: break-word; +} + +.data_table .act_as_row.labels { + font-weight: bold; +} + +.initial_balance .act_as_cell { + font-style:italic; +} + +.account_title { + font-size:10px; + font-weight:bold; + page-break-after: avoid; +} + +.act_as_cell.amount { + word-wrap:normal; + text-align:right; +} + +.list_table .act_as_cell{ + padding-left: 5px; +/* border-right:1px solid lightGrey; uncomment to active column lines */ +} +.list_table .act_as_cell.first_column { + padding-left: 0px; +/* border-left:1px solid lightGrey; uncomment to active column lines */ +} + +.sep_left { + border-left: 1px solid lightGrey; +} + +.account_level_1 { + text-transform: uppercase; + /*font-weight: bold;*/ + font-size: 15px; + background-color:#F0F0F0; +} + +/* +.account_level_1 .act_as_cell { + height: 30px; + vertical-align: bottom; +} +*/ + +.account_level_2 { + /*text-transform: uppercase; + font-weight: bold;*/ + font-size: 12px; + background-color:#F0F0F0; +} + +/* +.account_level_2 .act_as_cell { + height: 20px; + vertical-align: bottom; +} + +.account_level_3 { + text-transform: uppercase; + font-weight: bold; + font-size: 11px; + background-color:#FAFAFA; +} + +.account_level_4 { + font-weight: bold; + font-size: 11px; +} +*/ + +.account_level_5 { + +} + +.regular_account_type { + font-weight: normal; +} + +.view_account_type { + font-weight: bold; + +.account_level_consol { + font-weight: normal; + font-style: italic; +} + +.overflow_ellipsis { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +]]> + </field> + <field name="name">Financial Portrait Header</field> + </record> + </data> +</openerp> === added directory 'account_vat_registries_webkit/i18n' === added directory 'account_vat_registries_webkit/report' === added file 'account_vat_registries_webkit/report/__init__.py' --- account_vat_registries_webkit/report/__init__.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/report/__init__.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## +from . import vat_registries === added file 'account_vat_registries_webkit/report/report.xml' --- account_vat_registries_webkit/report/report.xml 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/report/report.xml 2013-04-21 20:48:29 +0000 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="account_report_vat_registries_webkit" model="ir.actions.report.xml"> + <field name="report_type">webkit</field> + <field name="report_name">account.account_report_vat_registries_webkit</field> + <field eval="[(6,0,[])]" name="groups_id"/> + <field eval="0" name="multi"/> + <field eval="0" name="auto"/> + <field eval="1" name="header"/> + <field name="model">account.account</field> + <field name="type">ir.actions.report.xml</field> + <field name="name">VAT Registries Webkit</field> + <field name="report_rml">account_vat_registries_webkit/report/templates/account_report_vat_registries.mako</field> + <field name="report_file">account_vat_registries_webkit/report/templates/account_report_vat_registries.mako</field> + </record> + + <record id="property_account_report_vat_registries_webkit" model="ir.property"> + <field name="name">account_report_vat_registries_webkit</field> + <field name="fields_id" ref="report_webkit.field_ir_act_report_xml_webkit_header"/> + <field eval="'ir.header_webkit,'+str(ref('account_vat_registries_webkit.VAT_portrait_header'))" model="ir.header_webkit" name="value"/> + <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"/> + </record> + + </data> +</openerp> === added directory 'account_vat_registries_webkit/report/templates' === added file 'account_vat_registries_webkit/report/templates/account_report_vat_registries.mako' --- account_vat_registries_webkit/report/templates/account_report_vat_registries.mako 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/report/templates/account_report_vat_registries.mako 2013-04-21 20:48:29 +0000 @@ -0,0 +1,132 @@ +<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <style type="text/css"> + ${css} + + .list_table .act_as_row { + margin-top: 10px; + margin-bottom: 10px; + font-size:10px; + } + + .account_line { + font-weight: bold; + font-size: 15px; + background-color:#F0F0F0; + } + + .account_line .act_as_cell { + height: 30px; + vertical-align: bottom; + } + + </style> + </head> + <body> + <%setLang(user.lang)%> + +<!--start header --> + <div class="act_as_table list_table" style="width: 95%;"> + <div class="act_as_thead"> + <div class="act_as_row labels"> + <div class="act_as_cell " style="width: 30px;">${_('Fiscal Year')}</div> + <div class="act_as_cell " style="width: 70px;">${_('Journal')}</div> + <div class="act_as_cell " style="width: 70px;">${_('Journal Type')}</div> + <div class="act_as_cell " style="width: 30px;">${_('Period')}</div> + <!--div class="act_as_cell " style="width: 50px;">${_('Report')}</div--> + + </div> + </div> + <div class="act_as_tbody"> + %for obj in objects: + <div class="act_as_row lines"> + <div class="act_as_cell " style="width: 30px;">${ obj.fiscalyear_id.name}</div> + <div class="act_as_cell " style="width: 70px;">${ obj.journal_id.name}</div> + <div class="act_as_cell " style="width: 70px;">${ obj.journal_id.type}</div> + <div class="act_as_cell " style="width: 30px;">${ obj.period_id.name}</div> + <!--div class="act_as_cell " style="width: 50px;">${ report_name or ''}</div--> + + </div> + %endfor + </div> + </div> +<!--end header --> + +<!--start body --> + <div class="act_as_table list_table" style="width: 95%; margin-top: 20px;"> + <div class="act_as_thead"> + <div class="act_as_row labels"> + <div class="act_as_cell first_row" style="width: 30px;">${_('Reg. Date')}</div> + <div class="act_as_cell first_row" style="width: 30px;">${_('Move Date')}</div> + <div class="act_as_cell first_row" style="width: 50px;">${_('Move Ref.')}</div> + <div class="act_as_cell first_row" style="width: 50px;">${_('Invoice Nr')}</div> + <div class="act_as_cell first_row" style="width: 60px;">${_('Partner')}</div> + <div class="act_as_cell first_row" style="width: 30px;">${_('Taxable Amount')}</div> + <div class="act_as_cell first_row" style="width: 30px;">${_('Tax')}</div> + <div class="act_as_cell first_row" style="width: 90px;">${_('Tax Description')}</div> + </div> + </div> + <div class="act_as_tbody"> + +%for obj in objects: +<%invoice_n = None%> +%for line in lines(obj.period_id.id, obj.journal_id.id): +%if line.tax_code_id.id: + +%if invoice_n != line.invoice_id.number and invoice_n != None: + <div class="act_as_row lines" style="border-top: 2px solid gray;"> +%else: + <div class="act_as_row lines"> +%endif + <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.registration_date, date=True)|entity}</div> + <div class="act_as_cell " style="width: 30px;">${formatLang(line.invoice_id.date_invoice, date=True)|entity}</div> + <div class="act_as_cell " style="width: 50px;">${ line.invoice_id.number}</div> + <div class="act_as_cell " style="width: 50px;">${ line.invoice_id.supplier_invoice_number or line.invoice_id.number or ''}</div> + <div class="act_as_cell " style="width: 60px;">${ line.invoice_id.partner_id.name}</div> +%if line.base_code_id.id: + <div class="act_as_cell amount" style="width: 30px;">${ line.base_amount *-1}</div> +%else: + <div class="act_as_cell amount" style="width: 30px;"></div> +%endif + <div class="act_as_cell amount" style="width: 30px;">${ line.tax_amount *-1}</div> + <div class="act_as_cell " style="width: 90px;">${ line.tax_code_id.name}</div> + </div> + + +<%invoice_n = line.invoice_id.number%> +%endif +%endfor +%endfor + + </div> + </div> +<!--end body --> + + <div class="act_as_table list_table" style="margin-left: 80px; margin-top: 20px; width: 50%;"> + <div class="act_as_thead"> + <div class="act_as_row labels"> + <div class="act_as_cell first_row" style="width: 80px;">${_('Tax Code')}</div> + <div class="act_as_cell first_row" style="width: 20px;">${_('Base Amount')}</div> + <div class="act_as_cell first_row" style="width: 20px;">${_('Tax Amount')}</div> + </div> + </div> + <div class="act_as_tbody"> +%for obj in objects: +%for obj_t in tax_total(obj.period_id.id, obj.journal_id.id): + <div class="act_as_row lines"> + <div class="act_as_cell" style="width: 80px;">${ obj_t[0]}</div> +%if not obj_t[4] is None: + <div class="act_as_cell amount" style="width: 20px;">${ obj_t[1] *-1}</div> +%else: + <div class="act_as_cell amount" style="width: 20px;"></div> +%endif + <div class="act_as_cell amount" style="width: 20px;">${ obj_t[2] *-1}</div> + </div> +%endfor +%endfor + </div> + </div> + + </body> +</html> === added file 'account_vat_registries_webkit/report/vat_registries.py' --- account_vat_registries_webkit/report/vat_registries.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/report/vat_registries.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,132 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright Camptocamp SA 2011 +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + + +from datetime import datetime + +from openerp import pooler +from openerp.report import report_sxw +from openerp.tools.translate import _ + +class vat_registries_webkit(report_sxw.rml_parse): + + def __init__(self, cursor, uid, name, context): + super(vat_registries_webkit, self).__init__(cursor, uid, name, context=context) + self.pool = pooler.get_pool(self.cr.dbname) + self.cursor = self.cr + self.sort_selection = 'am.name' + company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id + header_report_name = ' - '.join((_('VAT REGISTER'), company.name, company.currency_id.name)) + + footer_date_time = self.formatLang(str(datetime.today()), date_time=True) + + self.localcontext.update({ + 'cr': cursor, + 'uid': uid, + 'lines': self.tax_lines, + 'tax_total': self.tax_totals, + 'report_name': _('VAT Register'), + }) + + def _get_target_invoice(self, data): + #import pdb; pdb.set_trace() + if data.get('form', False) and data['form'].get('target_invoice', False): + if data['form']['target_invoice'] == 'all': + return _('All Entries (includes draft)') + return _('All Posted Entries') + return '' + + def _get_fiscalyear(self, data): + + obj_fy = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, data['form']['fiscalyear_id']) + + return obj_fy.name + + def set_context(self, objects, data, ids, report_type=None): + new_ids = ids + self.target_invoice = data['form'].get('target_invoice', 'all') + #import pdb; pdb.set_trace() + var = data['form'].get('fiscal_page_base') + + fiscalyear = self._get_fiscalyear(data) + self.localcontext.update({ + 'f_y': fiscalyear, + 'fiscal_page_base': data['form'].get('fiscal_page_base'), + }) + if (data['model'] == 'ir.ui.menu'): + self.period_ids = tuple(data['form']['periods']) + self.journal_ids = tuple(data['form']['journal_ids']) + new_ids = data['form'].get('active_ids', []) + objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids) + elif new_ids: + #in case of direct access from account.journal.period object, we need to set the journal_ids and periods_ids + self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),)) + res = self.cr.fetchall() + self.period_ids, self.journal_ids = zip(*res) + return super(vat_registries_webkit, self).set_context(objects, data, ids, report_type=report_type) + + def tax_lines(self, period_id, journal_id=False): + if not journal_id: + journal_id = self.journal_ids + else: + journal_id = [journal_id] + if not period_id: + period_id = self.period_ids + else: + period_id = [period_id] + + obj_tax_lines = self.pool.get('account.invoice.tax') + + invoice_state = ['open','paid'] + #da implementare se può essere utile avere una stampa con le fatture in bozza + #if self.target_invoice == 'all': + # invoice_state = ['open','paid','draft'] + # ext = ' OR ai.period_id IS NULL' + + 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) )) + ids = map(lambda x: x[0], self.cr.fetchall()) + return obj_tax_lines.browse(self.cr, self.uid, ids) + + def tax_totals(self, period_id, journal_id=False): + + if not journal_id: + journal_id = self.journal_ids + else: + journal_id = [journal_id] + if not period_id: + period_id = self.period_ids + else: + period_id = [period_id] + + obj_tax = self.pool.get('account.invoice.tax') + invoice_state = ['open','paid'] + + 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) )) + #ids = map(lambda x: x[0], self.cr.fetchall()) + #return obj_mline_t.browse(self.cr, self.uid, ids) + return self.cr.fetchall() + +report_sxw.report_sxw('report.account.account_report_vat_registries_webkit', + 'account.account', + 'addons/account_vat_registries_webkit/report/templates/account_report_vat_registries.mako', + parser=vat_registries_webkit) === added file 'account_vat_registries_webkit/report_menus.xml' --- account_vat_registries_webkit/report_menus.xml 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/report_menus.xml 2013-04-21 20:48:29 +0000 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + + <menuitem icon="STOCK_PRINT" name="VAT Registries" + parent="account.next_id_22" action="action_account_print_vat_registries_webkit" + groups="account.group_account_manager,account.group_account_user" id="account.menu_account_vat_registries_report"/> + + </data> +</openerp> === added directory 'account_vat_registries_webkit/wizard' === added file 'account_vat_registries_webkit/wizard/__init__.py' --- account_vat_registries_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/wizard/__init__.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# (c)2013 Sergio Corato +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from . import vatregistries_wizard === added file 'account_vat_registries_webkit/wizard/vatregistries_wizard.py' --- account_vat_registries_webkit/wizard/vatregistries_wizard.py 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/wizard/vatregistries_wizard.py 2013-04-21 20:48:29 +0000 @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Guewen Baconnier +# Copyright Camptocamp SA 2011 +# Copyright (C) 2013 Associazione OpenERP Italia +# (<http://www.openerp-italia.org>). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import fields, orm + +class account_print_vat_registries(orm.TransientModel): + _inherit = "account.common.journal.report" + _name = 'account.print.vat_registries' + _description = 'Account Print VAT Registries' + + _columns = { + 'sort_selection': fields.selection([('l.date', 'Date'), + ('am.name', 'Journal Entry Number'),], + 'Entries Sorted by', required=True), + 'journal_ids': fields.many2many('account.journal', + 'account_print_journal_vat_registries_rel', 'account_id', + 'journal_id', 'Journals', required=True), + 'target_invoice': fields.selection([('posted', 'All Posted Entries'), + ('all', 'All Entries (includes draft)'), + ], 'Target Invoices', required=True), + 'fiscal_page_base': fields.integer('Last page printed', required=True), + } + + _defaults = { + 'sort_selection': 'am.name', + 'filter': 'filter_period', + 'journal_ids': False, + 'target_invoice': 'posted', + 'fiscal_page_base': 0, + } + + def _print_report(self, cr, uid, ids, data, context=None): + # we update form with display account value + data = self.pre_print_report(cr, uid, ids, data, context=context) + data['form']['fiscal_page_base'] = self.browse(cr, uid, ids, context=context)[0].fiscal_page_base + + return {'type': 'ir.actions.report.xml', + 'report_name': 'account.account_report_vat_registries_webkit', + 'datas': data} + === added file 'account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml' --- account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml 1970-01-01 00:00:00 +0000 +++ account_vat_registries_webkit/wizard/vatregistries_wizard_view.xml 2013-04-21 20:48:29 +0000 @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="account_report_print_vat_registries" model="ir.ui.view"> + <field name="name">Account Print VAT Registries</field> + <field name="model">account.print.vat_registries</field> + <field name="inherit_id" ref="account.account_common_report_view" /> + <field name="arch" type="xml"> + <data> + <xpath expr="//field[@name='target_move']" position="replace"> + <!--field name="target_invoice"/--> + <!--field name="amount_currency"/--> + <field name="fiscal_page_base"/> + <newline/> + <field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" colspan="4" invisible="1"/> + <separator string="Periods" colspan="4"/> + <field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/> + <field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/> + <separator string="Journals" colspan="4"/> + <field name="journal_ids" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]" colspan="4" nolabel="1"/> + </xpath> + <xpath expr="//page[@name='filters']" position="replace"> + </xpath> + <xpath expr="//page[@name='journal_ids']" position="replace"> + </xpath> + </data> + </field> + </record> + + <record id="action_account_print_vat_registries_webkit" model="ir.actions.act_window"> + <field name="name">Print VAT Journal</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">account.print.vat_registries</field> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="target">new</field> + <field name="view_id" ref="account_report_print_vat_registries"/> + </record> + <menuitem + name="VAT Journals" + parent="account.menu_journals_report" + action="action_account_print_vat_registries_webkit" + id="menu_account_print_vat_registries" + icon="STOCK_PRINT" + sequence="1"/> + + </data> +</openerp>
_______________________________________________ Mailing list: https://launchpad.net/~openobject-italia-core-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~openobject-italia-core-devs More help : https://help.launchpad.net/ListHelp

