From 8a08f9899079cc7932e3aa20c4aa1bca9a69a10d Mon Sep 17 00:00:00 2001 From: hurrinico Date: Thu, 27 Nov 2014 10:22:50 +0100 Subject: [PATCH 01/26] [FIX] Porting vat_registries to 8 --- .../wizard/print_registro_iva.py | 105 --------------- .../AUTHORS.txt | 0 .../__init__.py | 0 .../__openerp__.py | 18 ++- .../account.py | 15 ++- .../account_view.xml | 0 .../i18n/it.po | 0 .../i18n/l10n_it_vat_registries.pot | 0 .../images/registro-iva-corrispettivi.png | Bin .../images/registro-iva-fatture-emesse.png | Bin .../invoice.py | 0 .../reports.xml | 0 .../templates/registro_iva_acquisti.mako | 0 .../templates/registro_iva_corrispettivi.mako | 0 .../templates/registro_iva_vendite.mako | 0 .../wizard/__init__.py | 0 .../wizard/print_registro_iva.py | 126 ++++++++++++++++++ .../wizard/print_registro_iva.xml | 2 +- 18 files changed, 147 insertions(+), 119 deletions(-) delete mode 100644 __unported__/l10n_it_vat_registries/wizard/print_registro_iva.py rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/AUTHORS.txt (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/__init__.py (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/__openerp__.py (81%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/account.py (74%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/account_view.xml (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/i18n/it.po (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/i18n/l10n_it_vat_registries.pot (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/images/registro-iva-corrispettivi.png (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/images/registro-iva-fatture-emesse.png (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/invoice.py (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/reports.xml (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/templates/registro_iva_acquisti.mako (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/templates/registro_iva_corrispettivi.mako (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/templates/registro_iva_vendite.mako (100%) rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/wizard/__init__.py (100%) create mode 100644 l10n_it_vat_registries/wizard/print_registro_iva.py rename {__unported__/l10n_it_vat_registries => l10n_it_vat_registries}/wizard/print_registro_iva.xml (96%) diff --git a/__unported__/l10n_it_vat_registries/wizard/print_registro_iva.py b/__unported__/l10n_it_vat_registries/wizard/print_registro_iva.py deleted file mode 100644 index e527202bb100..000000000000 --- a/__unported__/l10n_it_vat_registries/wizard/print_registro_iva.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2011 Associazione OpenERP Italia -# (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from osv import fields,osv -from tools.translate import _ -import time - -class wizard_registro_iva(osv.osv_memory): - - def _get_period(self, cr, uid, context=None): - ctx = dict(context or {}, account_period_prefer_normal=True) - period_ids = self.pool.get('account.period').find(cr, uid, context=ctx) - return period_ids - - _name = "wizard.registro.iva" - _columns = { - 'period_ids': fields.many2many('account.period', 'registro_iva_periods_rel', 'period_id', 'registro_id', 'Periods', help='Select periods you want retrieve documents from', required=True), - 'type': fields.selection([ - ('customer', 'Customer Invoices'), - ('supplier', 'Supplier Invoices'), - ('corrispettivi', 'Corrispettivi'), - ], 'Layout', required=True), - 'journal_ids': fields.many2many('account.journal', 'registro_iva_journals_rel', 'journal_id', 'registro_id', 'Journals', help='Select journals you want retrieve documents from', required=True), - 'tax_sign': fields.float('Tax amount sign', - help="Use -1 you have negative tax amounts and you want to print them prositive"), - 'message': fields.char('Message', size=64, readonly=True), - 'fiscal_page_base': fields.integer('Last printed page', required=True), - } - _defaults = { - 'type': 'customer', - 'period_ids': _get_period, - 'tax_sign': 1.0, - 'fiscal_page_base': 0, - } - - def print_registro(self, cr, uid, ids, context=None): - if context is None: - context = {} - wizard = self.browse(cr, uid, ids)[0] - move_obj = self.pool.get('account.move') - obj_model_data = self.pool.get('ir.model.data') - move_ids = move_obj.search(cr, uid, [ - ('journal_id', 'in', [j.id for j in wizard.journal_ids]), - ('period_id', 'in', [p.id for p in wizard.period_ids]), - ('state', '=', 'posted'), - ], order='date, name') - if not move_ids: - self.write(cr, uid, ids, {'message': _('No documents found in the current selection')}) - model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','wizard_registro_iva')]) - resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] - return { - 'name': _('No documents'), - 'res_id': ids[0], - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'wizard.registro.iva', - 'views': [(resource_id,'form')], - 'context': context, - 'type': 'ir.actions.act_window', - 'target': 'new', - } - datas = {'ids': move_ids} - datas['model'] = 'account.move' - datas['fiscal_page_base'] = wizard.fiscal_page_base - datas['period_ids'] = [p.id for p in wizard.period_ids] - datas['layout'] = wizard['type'] - datas['tax_sign'] = wizard['tax_sign'] - res= { - 'type': 'ir.actions.report.xml', - 'datas': datas, - } - if wizard['type'] == 'customer': - res['report_name'] = 'registro_iva_vendite' - elif wizard['type'] == 'supplier': - res['report_name'] = 'registro_iva_acquisti' - elif wizard['type'] == 'corrispettivi': - res['report_name'] = 'registro_iva_corrispettivi' - return res - - def on_type_changed(self, cr, uid, ids, j_type, context=None): - res={} - if j_type: - if j_type == 'supplier': - res['value'] = {'tax_sign': -1} - else: - res['value'] = {'tax_sign': 1} - return res diff --git a/__unported__/l10n_it_vat_registries/AUTHORS.txt b/l10n_it_vat_registries/AUTHORS.txt similarity index 100% rename from __unported__/l10n_it_vat_registries/AUTHORS.txt rename to l10n_it_vat_registries/AUTHORS.txt diff --git a/__unported__/l10n_it_vat_registries/__init__.py b/l10n_it_vat_registries/__init__.py similarity index 100% rename from __unported__/l10n_it_vat_registries/__init__.py rename to l10n_it_vat_registries/__init__.py diff --git a/__unported__/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py similarity index 81% rename from __unported__/l10n_it_vat_registries/__openerp__.py rename to l10n_it_vat_registries/__openerp__.py index d227dcf9f9a7..b2321c7befb8 100644 --- a/__unported__/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -24,19 +24,25 @@ 'name': 'Italian Localisation - VAT Registries', 'version': '0.2', 'category': 'Localisation/Italy', - 'description': """Accounting reports for Italian localization - VAT Registries\nhttp://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""", + 'description': """Accounting reports for Italian localization - / + VAT Registries\n + http://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""", 'author': 'OpenERP Italian Community', 'website': 'http://www.openerp-italia.org', 'license': 'AGPL-3', - "depends" : ['report_webkit', 'l10n_it_base', 'l10n_it_fiscalcode', 'l10n_it_partially_deductible_vat'], - "init_xml" : [ + "depends": [ + 'report_webkit', + 'l10n_it_base', + 'l10n_it_fiscalcode', + 'l10n_it_partially_deductible_vat'], + "init_xml": [ ], - "update_xml" : [ + "update_xml": [ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', ], - "demo_xml" : [], + "demo_xml": [], "active": False, - 'installable': False + 'installable': True } diff --git a/__unported__/l10n_it_vat_registries/account.py b/l10n_it_vat_registries/account.py similarity index 74% rename from __unported__/l10n_it_vat_registries/account.py rename to l10n_it_vat_registries/account.py index bf909fc1fd22..c2262d38bafc 100644 --- a/__unported__/l10n_it_vat_registries/account.py +++ b/l10n_it_vat_registries/account.py @@ -19,13 +19,14 @@ # ############################################################################## -from openerp.osv import fields, osv -from openerp.tools.translate import _ +from openerp import models, fields, api, _ -class account_tax_code(osv.osv): +class account_tax_code(models.Model): _inherit = "account.tax.code" - _columns = { - 'is_base': fields.boolean('Is base', help="This tax code is used for base amounts (field used by VAT registries)"), - 'exclude_from_registries': fields.boolean('Exclude from VAT registries'), - } + is_base = fields.Boolean( + string='Is base', + help="This tax code is used for base amounts \ + (field used by VAT registries)"), + exclude_from_registries = fields.Boolean( + string='Exclude from VAT registries'), diff --git a/__unported__/l10n_it_vat_registries/account_view.xml b/l10n_it_vat_registries/account_view.xml similarity index 100% rename from __unported__/l10n_it_vat_registries/account_view.xml rename to l10n_it_vat_registries/account_view.xml diff --git a/__unported__/l10n_it_vat_registries/i18n/it.po b/l10n_it_vat_registries/i18n/it.po similarity index 100% rename from __unported__/l10n_it_vat_registries/i18n/it.po rename to l10n_it_vat_registries/i18n/it.po diff --git a/__unported__/l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot b/l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot similarity index 100% rename from __unported__/l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot rename to l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot diff --git a/__unported__/l10n_it_vat_registries/images/registro-iva-corrispettivi.png b/l10n_it_vat_registries/images/registro-iva-corrispettivi.png similarity index 100% rename from __unported__/l10n_it_vat_registries/images/registro-iva-corrispettivi.png rename to l10n_it_vat_registries/images/registro-iva-corrispettivi.png diff --git a/__unported__/l10n_it_vat_registries/images/registro-iva-fatture-emesse.png b/l10n_it_vat_registries/images/registro-iva-fatture-emesse.png similarity index 100% rename from __unported__/l10n_it_vat_registries/images/registro-iva-fatture-emesse.png rename to l10n_it_vat_registries/images/registro-iva-fatture-emesse.png diff --git a/__unported__/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py similarity index 100% rename from __unported__/l10n_it_vat_registries/invoice.py rename to l10n_it_vat_registries/invoice.py diff --git a/__unported__/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml similarity index 100% rename from __unported__/l10n_it_vat_registries/reports.xml rename to l10n_it_vat_registries/reports.xml diff --git a/__unported__/l10n_it_vat_registries/templates/registro_iva_acquisti.mako b/l10n_it_vat_registries/templates/registro_iva_acquisti.mako similarity index 100% rename from __unported__/l10n_it_vat_registries/templates/registro_iva_acquisti.mako rename to l10n_it_vat_registries/templates/registro_iva_acquisti.mako diff --git a/__unported__/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako b/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako similarity index 100% rename from __unported__/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako rename to l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako diff --git a/__unported__/l10n_it_vat_registries/templates/registro_iva_vendite.mako b/l10n_it_vat_registries/templates/registro_iva_vendite.mako similarity index 100% rename from __unported__/l10n_it_vat_registries/templates/registro_iva_vendite.mako rename to l10n_it_vat_registries/templates/registro_iva_vendite.mako diff --git a/__unported__/l10n_it_vat_registries/wizard/__init__.py b/l10n_it_vat_registries/wizard/__init__.py similarity index 100% rename from __unported__/l10n_it_vat_registries/wizard/__init__.py rename to l10n_it_vat_registries/wizard/__init__.py diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py new file mode 100644 index 000000000000..938bd91d4f13 --- /dev/null +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -0,0 +1,126 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2011 Associazione OpenERP Italia +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ + +class wizard_registro_iva(models.TransientModel): + + @api.model + def _get_period(self): + ctx = dict(self._context or {}, account_period_prefer_normal=True) + period_ids = self.env[ + 'account.period'].find(self._cr, self.env.user, context=ctx) + return period_ids + + _name = "wizard.registro.iva" + + period_ids = fields.Many2many( + 'account.period', + 'registro_iva_periods_rel', + 'period_id', + 'registro_id', + string='Periods', + help='Select periods you want retrieve documents from', + required=True) + type = fields.Selection([ + ('customer', 'Customer Invoices'), + ('supplier', 'Supplier Invoices'), + ('corrispettivi', 'Corrispettivi'), + ], 'Layout', required=True) + journal_ids = fields.Many2many( + 'account.journal', + 'registro_iva_journals_rel', + 'journal_id', + 'registro_id', + string='Journals', + help='Select journals you want retrieve documents from', + required=True) + tax_sign = fields.Float( + string='Tax amount sign', + help="Use -1 you have negative tax \ + amounts and you want to print them prositive") + message = fields.Char(string='Message', size=64, readonly=True) + fiscal_page_base = fields.Integer( + string='Last printed page', + required=True) + + _defaults = { + 'type': 'customer', + 'period_ids': _get_period, + 'tax_sign': 1.0, + 'fiscal_page_base': 0, + } + + @api.one + def print_registro(self): + move_obj = self.env('account.move') + obj_model_data = self.env('ir.model.data') + move_ids = move_obj.search([ + ('journal_id', 'in', [j.id for j in self.journal_ids]), + ('period_id', 'in', [p.id for p in self.period_ids]), + ('state', '=', 'posted'), + ], order='date, name') + if not move_ids: + self.message = _('No documents found in the current selection') + model_data_ids = obj_model_data.search( + [('model', '=', 'ir.ui.view'), + ('name', '=', 'wizard_registro_iva')]) + resource_id = obj_model_data.read( + self._cr, + self.env, + model_data_ids, + fields=['res_id'])[0]['res_id'] + return { + 'name': _('No documents'), + 'res_id': self.id, + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'wizard.registro.iva', + 'views': [(resource_id, 'form')], + 'context': self._context, + 'type': 'ir.actions.act_window', + 'target': 'new', + } + datas = {'ids': move_ids} + datas['model'] = 'account.move' + datas['fiscal_page_base'] = self.fiscal_page_base + datas['period_ids'] = [p.id for p in self.period_ids] + datas['layout'] = self.type + datas['tax_sign'] = self.tax_sign + res = { + 'type': 'ir.actions.report.xml', + 'datas': datas, + } + if self.type == 'customer': + res['report_name'] = 'registro_iva_vendite' + elif self.type == 'supplier': + res.report_name = 'registro_iva_acquisti' + elif self.type == 'corrispettivi': + res['report_name'] = 'registro_iva_corrispettivi' + return res + + @api.onchange('type') + def on_type_changed(self): + if self.type: + if self.type == 'supplier': + self.tax_sign = -1 + else: + self.tax_sign = 1 diff --git a/__unported__/l10n_it_vat_registries/wizard/print_registro_iva.xml b/l10n_it_vat_registries/wizard/print_registro_iva.xml similarity index 96% rename from __unported__/l10n_it_vat_registries/wizard/print_registro_iva.xml rename to l10n_it_vat_registries/wizard/print_registro_iva.xml index 0359fc4e3d12..8cd3caa75a67 100644 --- a/__unported__/l10n_it_vat_registries/wizard/print_registro_iva.xml +++ b/l10n_it_vat_registries/wizard/print_registro_iva.xml @@ -9,7 +9,7 @@
- + From 78a3d970b99f8b1a633a4b87dfa2e65e57bf265d Mon Sep 17 00:00:00 2001 From: hurrinico Date: Thu, 27 Nov 2014 16:02:30 +0100 Subject: [PATCH 02/26] [FIX] fix import and depends --- l10n_it_vat_registries/__openerp__.py | 6 ++---- l10n_it_vat_registries/account.py | 6 +++--- l10n_it_vat_registries/invoice.py | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index b2321c7befb8..071bff09f2a8 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -30,11 +30,9 @@ 'author': 'OpenERP Italian Community', 'website': 'http://www.openerp-italia.org', 'license': 'AGPL-3', - "depends": [ + "depends": ['account', 'report_webkit', - 'l10n_it_base', - 'l10n_it_fiscalcode', - 'l10n_it_partially_deductible_vat'], + 'l10n_it_base'], "init_xml": [ ], "update_xml": [ diff --git a/l10n_it_vat_registries/account.py b/l10n_it_vat_registries/account.py index c2262d38bafc..f309f49d70c6 100644 --- a/l10n_it_vat_registries/account.py +++ b/l10n_it_vat_registries/account.py @@ -25,8 +25,8 @@ class account_tax_code(models.Model): _inherit = "account.tax.code" is_base = fields.Boolean( - string='Is base', + string='Is base', help="This tax code is used for base amounts \ - (field used by VAT registries)"), + (field used by VAT registries)") exclude_from_registries = fields.Boolean( - string='Exclude from VAT registries'), + string='Exclude from VAT registries') diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index 9cbb06f0008b..b0f849cefb33 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -20,8 +20,8 @@ ############################################################################## import time -from report import report_sxw -from tools.translate import _ +from openerp.report import report_sxw +from openerp import _ import logging from datetime import datetime From 8162bf9c897a110bab9babc8cb8ab6710364fc60 Mon Sep 17 00:00:00 2001 From: hurrinico Date: Fri, 28 Nov 2014 14:37:41 +0100 Subject: [PATCH 03/26] [FIX] Parser mod --- l10n_it_vat_registries/invoice.py | 119 ++++++++++++++++++------------ 1 file changed, 71 insertions(+), 48 deletions(-) diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index b0f849cefb33..02f39e9b009e 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -30,26 +30,34 @@ class Parser(report_sxw.rml_parse): def _tax_amounts_by_code(self, move): - res={} + res = {} for move_line in move.line_id: - if move_line.tax_code_id and not move_line.tax_code_id.exclude_from_registries and move_line.tax_amount: + if ( + move_line.tax_code_id + and not move_line.tax_code_id.exclude_from_registries + and move_line.tax_amount + ): if not res.get(move_line.tax_code_id.id): res[move_line.tax_code_id.id] = 0.0 - self.localcontext['used_tax_codes'][move_line.tax_code_id.id] = True - res[move_line.tax_code_id.id] += (move_line.tax_amount + self.localcontext['used_tax_codes'][ + move_line.tax_code_id.id] = True + res[move_line.tax_code_id.id] += ( + move_line.tax_amount * self.localcontext['data']['tax_sign']) return res def _get_tax_lines(self, move): - res=[] - tax_code_obj=self.pool.get('account.tax.code') - # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA - index=0 + res = [] + tax_code_obj = self.pool.get('account.tax.code') + # index è usato per non ripetere la stampa dei dati fattura quando ci + # sono più codici IVA + index = 0 invoice = False for move_line in move.line_id: if move_line.invoice: if invoice and invoice.id != move_line.invoice.id: - raise Exception(_("Move %s contains different invoices") % move.name) + raise Exception( + _("Move %s contains different invoices") % move.name) invoice = move_line.invoice amounts_by_code = self._tax_amounts_by_code(move) for tax_code_id in amounts_by_code: @@ -59,9 +67,10 @@ def _get_tax_lines(self, move): 'amount': amounts_by_code[tax_code_id], 'index': index, 'invoice_date': (invoice and invoice.date_invoice - or move.date or ''), - 'supplier_invoice_number': (invoice and invoice.supplier_invoice_number or '') - } + or move.date or ''), + 'supplier_invoice_number': ( + invoice and invoice.supplier_invoice_number or '') + } res.append(tax_item) index += 1 return res @@ -71,68 +80,78 @@ def _get_invoice_total(self, move): receivable_payable_found = False for move_line in move.line_id: if move_line.account_id.type == 'receivable': - total += move_line.debit or ( - move_line.credit) + total += move_line.debit or (- move_line.credit) receivable_payable_found = True elif move_line.account_id.type == 'payable': - total += ( - move_line.debit) or move_line.credit + total += (- move_line.debit) or move_line.credit receivable_payable_found = True if receivable_payable_found: return abs(total) else: return abs(move.amount) - + def build_parent_tax_codes(self, tax_code): - res={} + res = {} if tax_code.parent_id and tax_code.parent_id.parent_id: - res[tax_code.parent_id.id]=True + res[tax_code.parent_id.id] = True res.update(self.build_parent_tax_codes(tax_code.parent_id)) return res - + def _compute_totals(self, tax_code_ids): - res=[] - res_dict={} + res = [] + res_dict = {} tax_code_obj = self.pool.get('account.tax.code') for period_id in self.localcontext['data']['period_ids']: - for tax_code in tax_code_obj.browse(self.cr, self.uid, + for tax_code in tax_code_obj.browse( + self.cr, self.uid, tax_code_ids, context={ - 'period_id': period_id, - }): + 'period_id': period_id, + } + ): if not res_dict.get(tax_code.id): res_dict[tax_code.id] = 0.0 - res_dict[tax_code.id] += (tax_code.sum_period + res_dict[tax_code.id] += ( + tax_code.sum_period * self.localcontext['data']['tax_sign']) for tax_code_id in res_dict: tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) if res_dict[tax_code_id]: - res.append((tax_code.name,res_dict[tax_code_id],tax_code.is_base)) + res.append( + (tax_code.name, res_dict[tax_code_id], tax_code.is_base)) return res - + def _get_tax_codes(self): return self._compute_totals(self.localcontext['used_tax_codes'].keys()) - + def _get_tax_codes_totals(self): parent_codes = {} tax_code_obj = self.pool.get('account.tax.code') - for tax_code in tax_code_obj.browse(self.cr, self.uid, - self.localcontext['used_tax_codes'].keys()): + for tax_code in tax_code_obj.browse( + self.cr, self.uid, + self.localcontext['used_tax_codes'].keys() + ): parent_codes.update(self.build_parent_tax_codes(tax_code)) return self._compute_totals(parent_codes.keys()) - + def _get_start_date(self): period_obj = self.pool.get('account.period') start_date = False - for period in period_obj.browse(self.cr,self.uid, - self.localcontext['data']['period_ids']): + for period in period_obj.browse( + self.cr, self.uid, + self.localcontext['data']['period_ids'] + ): period_start = datetime.strptime(period.date_start, '%Y-%m-%d') if not start_date or start_date > period_start: start_date = period_start return start_date.strftime('%Y-%m-%d') - + def _get_end_date(self): period_obj = self.pool.get('account.period') end_date = False - for period in period_obj.browse(self.cr,self.uid, - self.localcontext['data']['period_ids']): + for period in period_obj.browse( + self.cr, self.uid, + self.localcontext['data']['period_ids'] + ): period_end = datetime.strptime(period.date_stop, '%Y-%m-%d') if not end_date or end_date < period_end: end_date = period_end @@ -154,17 +173,21 @@ def set_context(self, objects, data, ids, report_type=None): self.localcontext.update({ 'fiscal_page_base': data.get('fiscal_page_base'), }) - return super(Parser, self).set_context(objects, data, ids, report_type=report_type) + return super(Parser, self).set_context( + objects, data, ids, report_type=report_type) -report_sxw.report_sxw('report.registro_iva_vendite', - 'registro_iva_vendite', - 'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako', - parser=Parser) -report_sxw.report_sxw('report.registro_iva_acquisti', - 'registro_iva_acquisti', - 'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako', - parser=Parser) -report_sxw.report_sxw('report.registro_iva_corrispettivi', - 'registro_iva_corrispettivi', - 'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako', - parser=Parser) +report_sxw.report_sxw( + 'report.registro_iva_vendite', + 'registro_iva_vendite', + 'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako', + parser=Parser) +report_sxw.report_sxw( + 'report.registro_iva_acquisti', + 'registro_iva_acquisti', + 'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako', + parser=Parser) +report_sxw.report_sxw( + 'report.registro_iva_corrispettivi', + 'registro_iva_corrispettivi', + 'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako', + parser=Parser) From 0e5a78a90a3d52b6a3e634b280a3bde3c9255fcd Mon Sep 17 00:00:00 2001 From: hurrinico Date: Fri, 28 Nov 2014 15:53:37 +0100 Subject: [PATCH 04/26] [FIX] Last 7 Version commit and default change --- l10n_it_vat_registries/__init__.py | 14 +- l10n_it_vat_registries/__openerp__.py | 28 +-- l10n_it_vat_registries/account.py | 8 +- l10n_it_vat_registries/invoice.py | 10 +- l10n_it_vat_registries/reports.xml | 165 +++++++++++------- .../templates/registro_iva_acquisti.mako | 16 +- .../templates/registro_iva_corrispettivi.mako | 10 +- .../templates/registro_iva_vendite.mako | 14 +- l10n_it_vat_registries/wizard/__init__.py | 10 +- .../wizard/print_registro_iva.py | 21 +-- .../wizard/print_registro_iva.xml | 2 +- 11 files changed, 165 insertions(+), 133 deletions(-) diff --git a/l10n_it_vat_registries/__init__.py b/l10n_it_vat_registries/__init__.py index b9688d289f09..32d34e3d4beb 100644 --- a/l10n_it_vat_registries/__init__.py +++ b/l10n_it_vat_registries/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2011-2013 Associazione OpenERP Italia -# (). +# (). # # 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 @@ -17,8 +17,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# -import wizard -import invoice -import account +from . import wizard +from . import invoice +from . import account diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 071bff09f2a8..161509e219b1 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2011-2013 Associazione OpenERP Italia -# (). +# (). # Copyright (C) 2012 Agile Business Group sagl () # Copyright (C) 2012 Domsense srl () # @@ -19,28 +19,30 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# { 'name': 'Italian Localisation - VAT Registries', 'version': '0.2', 'category': 'Localisation/Italy', - 'description': """Accounting reports for Italian localization - / - VAT Registries\n - http://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""", + 'description': """Accounting reports for Italian localization +- VAT Registries +http://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""", 'author': 'OpenERP Italian Community', 'website': 'http://www.openerp-italia.org', 'license': 'AGPL-3', - "depends": ['account', - 'report_webkit', - 'l10n_it_base'], + "depends": [ + 'report_webkit', + 'l10n_it_base', + 'l10n_it_fiscalcode', + 'l10n_it_partially_deductible_vat'], "init_xml": [ - ], + ], "update_xml": [ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', - ], + ], "demo_xml": [], "active": False, - 'installable': True + "installable": True } diff --git a/l10n_it_vat_registries/account.py b/l10n_it_vat_registries/account.py index f309f49d70c6..39f144d93e45 100644 --- a/l10n_it_vat_registries/account.py +++ b/l10n_it_vat_registries/account.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2013 Associazione OpenERP Italia -# (). +# (). # # 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 @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# from openerp import models, fields, api, _ diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index 02f39e9b009e..42b1263a8894 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2011-2013 Associazione OpenERP Italia -# (). +# (). # # 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 @@ -17,9 +17,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# -import time from openerp.report import report_sxw from openerp import _ import logging @@ -27,6 +26,7 @@ _logger = logging.getLogger(__name__) + class Parser(report_sxw.rml_parse): def _tax_amounts_by_code(self, move): diff --git a/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml index 7daec3293b57..d1071b041c5f 100644 --- a/l10n_it_vat_registries/reports.xml +++ b/l10n_it_vat_registries/reports.xml @@ -20,27 +20,41 @@ } } + - <% setLang(company.partner_id.lang or "en_US") %> -

Registro I.V.A. Vendite

-

${company.partner_id.name or ''|entity}

- - - - - -
-
${company.partner_id.street or ''|entity}
-
${company.partner_id.street2 or ''|entity}
-
${company.partner_id.zip or ''|entity}
-
${company.partner_id.city or ''|entity}
-
${company.partner_id.province and company.partner_id.province.code or ''|entity}
-
-
P. IVA: ${company.partner_id.vat or ''|entity}
-
Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Registro I.V.A. Vendite
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n}
]]> @@ -73,9 +87,6 @@ ]]>
+ - <% setLang(company.partner_id.lang or "en_US") %> -

Registro I.V.A. Acquisti

-

${company.partner_id.name or ''|entity}

- - - - - -
-
${company.partner_id.street or ''|entity}
-
${company.partner_id.street2 or ''|entity}
-
${company.partner_id.zip or ''|entity}
-
${company.partner_id.city or ''|entity}
-
${company.partner_id.province and company.partner_id.province.code or ''|entity}
-
-
P. IVA: ${company.partner_id.vat or ''|entity}
-
Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Registro I.V.A. Acquisti
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n}
]]> @@ -154,9 +179,6 @@ thead{ ]]>
+ - <% setLang(company.partner_id.lang or "en_US") %> -

Registro I.V.A. Corrispettivi

-

${company.partner_id.name or ''|entity}

- - - - - -
-
${company.partner_id.street or ''|entity}
-
${company.partner_id.street2 or ''|entity}
-
${company.partner_id.zip or ''|entity}
-
${company.partner_id.city or ''|entity}
-
${company.partner_id.province and company.partner_id.province.code or ''|entity}
-
-
P. IVA: ${company.partner_id.vat or ''|entity}
-
Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Registro I.V.A. Corrispettivi
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n}
]]> @@ -235,9 +271,6 @@ thead{ ]]>
%endif %if line['index']==0: - ${object.partner_id.name or ''| entity} +
${object.partner_id.name or ''| entity}
%endif %if line['index']==0: @@ -70,7 +70,7 @@ %endif %if line['index']==0: - ${object.name or ''| entity} +
${object.name or ''| entity}
%endif %if line['index']==0: @@ -78,7 +78,7 @@ %endif %if line['index']==0: - ${ line['supplier_invoice_number'] or '' | entity} +
${ line['supplier_invoice_number'] or '' | entity}
%endif %if line['index']==0: @@ -94,7 +94,7 @@ %endif %if line['index']==0: - ${object.journal_id.name or ''| entity} +
${object.journal_id.name or ''| entity}
%endif %if line['index']==0: @@ -106,14 +106,14 @@ %endif %if line['index']==0: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%else: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%endif %if line['index']==0: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%else: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%endif %endfor diff --git a/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako b/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako index bbba8270d56e..c1d9fac2c354 100644 --- a/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako +++ b/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako @@ -58,7 +58,7 @@ %endif %if line['index']==0: - ${object.journal_id.name or ''| entity} +
${object.journal_id.name or ''| entity}
%endif %if line['index']==0: @@ -70,14 +70,14 @@ %endif %if line['index']==0: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%else: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%endif %if line['index']==0: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%else: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%endif %endfor diff --git a/l10n_it_vat_registries/templates/registro_iva_vendite.mako b/l10n_it_vat_registries/templates/registro_iva_vendite.mako index 9cf29af0c9fb..d7a86f4bdedf 100644 --- a/l10n_it_vat_registries/templates/registro_iva_vendite.mako +++ b/l10n_it_vat_registries/templates/registro_iva_vendite.mako @@ -61,7 +61,7 @@ %endif %if line['index']==0: - ${object.partner_id.name or ''| entity} +
${object.partner_id.name or ''| entity}
%endif %if line['index']==0: @@ -69,7 +69,7 @@ %endif %if line['index']==0: - ${object.name or ''| entity} +
${object.name or ''| entity}
%endif %if line['index']==0: @@ -85,7 +85,7 @@ %endif %if line['index']==0: - ${object.journal_id.name or ''| entity} +
${object.journal_id.name or ''| entity}
%endif %if line['index']==0: @@ -97,14 +97,14 @@ %endif %if line['index']==0: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%else: - ${ (line['tax_code_name']) or ''| entity} +
${ (line['tax_code_name']) or ''| entity}
%endif %if line['index']==0: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%else: - ${ formatLang(line['amount'])| entity} +
${ formatLang(line['amount'])| entity}
%endif %endfor diff --git a/l10n_it_vat_registries/wizard/__init__.py b/l10n_it_vat_registries/wizard/__init__.py index 31347a4fde9c..06bd30ce766d 100644 --- a/l10n_it_vat_registries/wizard/__init__.py +++ b/l10n_it_vat_registries/wizard/__init__.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2011-2013 Associazione OpenERP Italia -# (). +# (). # # 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 @@ -17,6 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# -import print_registro_iva +from . import print_registro_iva diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index 938bd91d4f13..f5ed63e0b1c3 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -1,8 +1,8 @@ # -*- encoding: utf-8 -*- -############################################################################## -# +# +# # Copyright (C) 2011 Associazione OpenERP Italia -# (). +# (). # # 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 @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -############################################################################## +# from openerp import models, fields, api, _ @@ -38,13 +38,15 @@ def _get_period(self): 'period_id', 'registro_id', string='Periods', + default=_get_period, help='Select periods you want retrieve documents from', required=True) type = fields.Selection([ ('customer', 'Customer Invoices'), ('supplier', 'Supplier Invoices'), ('corrispettivi', 'Corrispettivi'), - ], 'Layout', required=True) + ], 'Layout', required=True, + default='customer') journal_ids = fields.Many2many( 'account.journal', 'registro_iva_journals_rel', @@ -55,20 +57,15 @@ def _get_period(self): required=True) tax_sign = fields.Float( string='Tax amount sign', + default=1.0, help="Use -1 you have negative tax \ amounts and you want to print them prositive") message = fields.Char(string='Message', size=64, readonly=True) fiscal_page_base = fields.Integer( string='Last printed page', + default=0, required=True) - _defaults = { - 'type': 'customer', - 'period_ids': _get_period, - 'tax_sign': 1.0, - 'fiscal_page_base': 0, - } - @api.one def print_registro(self): move_obj = self.env('account.move') diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.xml b/l10n_it_vat_registries/wizard/print_registro_iva.xml index 8cd3caa75a67..0359fc4e3d12 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.xml +++ b/l10n_it_vat_registries/wizard/print_registro_iva.xml @@ -9,7 +9,7 @@ - + From fccb2895ba0e68af3aa26e6d17dbb11d44762b92 Mon Sep 17 00:00:00 2001 From: hurrinico Date: Fri, 28 Nov 2014 18:30:23 +0100 Subject: [PATCH 05/26] [FIX] fix user and flake8 --- l10n_it_vat_registries/account.py | 2 +- l10n_it_vat_registries/wizard/print_registro_iva.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_it_vat_registries/account.py b/l10n_it_vat_registries/account.py index 39f144d93e45..8729f2f70aec 100644 --- a/l10n_it_vat_registries/account.py +++ b/l10n_it_vat_registries/account.py @@ -19,7 +19,7 @@ # # -from openerp import models, fields, api, _ +from openerp import models, fields class account_tax_code(models.Model): _inherit = "account.tax.code" diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index f5ed63e0b1c3..343b02bcb946 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -82,7 +82,7 @@ def print_registro(self): ('name', '=', 'wizard_registro_iva')]) resource_id = obj_model_data.read( self._cr, - self.env, + self.env.user, model_data_ids, fields=['res_id'])[0]['res_id'] return { From 55ce12625bffb04dd8a1203f9071fa33e09e4906 Mon Sep 17 00:00:00 2001 From: hurrinico Date: Mon, 1 Dec 2014 17:47:02 +0100 Subject: [PATCH 06/26] [FIX] Fix method invocation --- l10n_it_vat_registries/__openerp__.py | 4 ++-- .../wizard/print_registro_iva.py | 14 +++++--------- .../wizard/print_registro_iva.xml | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 161509e219b1..8948202ec497 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -33,8 +33,8 @@ "depends": [ 'report_webkit', 'l10n_it_base', - 'l10n_it_fiscalcode', - 'l10n_it_partially_deductible_vat'], + 'account' + ], "init_xml": [ ], "update_xml": [ diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index 343b02bcb946..77486176ad6b 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -27,10 +27,11 @@ class wizard_registro_iva(models.TransientModel): def _get_period(self): ctx = dict(self._context or {}, account_period_prefer_normal=True) period_ids = self.env[ - 'account.period'].find(self._cr, self.env.user, context=ctx) + 'account.period'].with_context(context=ctx).find() return period_ids _name = "wizard.registro.iva" + _rec_name = "type" period_ids = fields.Many2many( 'account.period', @@ -68,8 +69,8 @@ def _get_period(self): @api.one def print_registro(self): - move_obj = self.env('account.move') - obj_model_data = self.env('ir.model.data') + move_obj = self.env['account.move'] + obj_model_data = self.env['ir.model.data'] move_ids = move_obj.search([ ('journal_id', 'in', [j.id for j in self.journal_ids]), ('period_id', 'in', [p.id for p in self.period_ids]), @@ -80,18 +81,13 @@ def print_registro(self): model_data_ids = obj_model_data.search( [('model', '=', 'ir.ui.view'), ('name', '=', 'wizard_registro_iva')]) - resource_id = obj_model_data.read( - self._cr, - self.env.user, - model_data_ids, - fields=['res_id'])[0]['res_id'] return { 'name': _('No documents'), 'res_id': self.id, 'view_type': 'form', 'view_mode': 'form', 'res_model': 'wizard.registro.iva', - 'views': [(resource_id, 'form')], + 'views': [(model_data_ids.res_id, 'form')], 'context': self._context, 'type': 'ir.actions.act_window', 'target': 'new', diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.xml b/l10n_it_vat_registries/wizard/print_registro_iva.xml index 0359fc4e3d12..8cd3caa75a67 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.xml +++ b/l10n_it_vat_registries/wizard/print_registro_iva.xml @@ -9,7 +9,7 @@ - + From ca588da7c103dd5cc3a2554fa42c2387c5d08945 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Tue, 2 Dec 2014 08:49:12 +0100 Subject: [PATCH 07/26] [FIX] metadata --- l10n_it_vat_registries/__openerp__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 8948202ec497..39fe7cb2babf 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -35,14 +35,11 @@ 'l10n_it_base', 'account' ], - "init_xml": [ - ], - "update_xml": [ + "data": [ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', ], - "demo_xml": [], "active": False, "installable": True } From 37df4280b890538b9412808f445e1a21cfffba9b Mon Sep 17 00:00:00 2001 From: hurrinico Date: Thu, 4 Dec 2014 16:58:37 +0100 Subject: [PATCH 08/26] [FIX] try to fix qweb --- l10n_it_vat_registries/__openerp__.py | 1 + l10n_it_vat_registries/invoice.py | 25 ++++++-- l10n_it_vat_registries/reports.xml | 13 +++- .../wizard/print_registro_iva.py | 64 ++++++++----------- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 39fe7cb2babf..6c676e376a57 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -39,6 +39,7 @@ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', + 'views/report_registro_iva_vendite.xml' ], "active": False, "installable": True diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index 42b1263a8894..9360d8a7d103 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -20,6 +20,7 @@ # from openerp.report import report_sxw +from openerp.osv import osv from openerp import _ import logging from datetime import datetime @@ -43,9 +44,13 @@ def _tax_amounts_by_code(self, move): move_line.tax_code_id.id] = True res[move_line.tax_code_id.id] += ( move_line.tax_amount - * self.localcontext['data']['tax_sign']) + * self.localcontext['data']['form']['tax_sign']) return res + def _get_move(self, move_ids): + move_list = self.pool.get('account.move').browse(self.cr, self.uid, move_ids) + return move_list + def _get_tax_lines(self, move): res = [] tax_code_obj = self.pool.get('account.tax.code') @@ -53,6 +58,7 @@ def _get_tax_lines(self, move): # sono più codici IVA index = 0 invoice = False + import pdb; pdb.set_trace() for move_line in move.line_id: if move_line.invoice: if invoice and invoice.id != move_line.invoice.id: @@ -101,7 +107,7 @@ def _compute_totals(self, tax_code_ids): res = [] res_dict = {} tax_code_obj = self.pool.get('account.tax.code') - for period_id in self.localcontext['data']['period_ids']: + for period_id in self.localcontext['data']['form']['period_ids']: for tax_code in tax_code_obj.browse( self.cr, self.uid, tax_code_ids, context={ @@ -112,7 +118,7 @@ def _compute_totals(self, tax_code_ids): res_dict[tax_code.id] = 0.0 res_dict[tax_code.id] += ( tax_code.sum_period - * self.localcontext['data']['tax_sign']) + * self.localcontext['data']['form']['tax_sign']) for tax_code_id in res_dict: tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) if res_dict[tax_code_id]: @@ -138,7 +144,7 @@ def _get_start_date(self): start_date = False for period in period_obj.browse( self.cr, self.uid, - self.localcontext['data']['period_ids'] + self.localcontext['data']['form']['period_ids'] ): period_start = datetime.strptime(period.date_start, '%Y-%m-%d') if not start_date or start_date > period_start: @@ -150,7 +156,7 @@ def _get_end_date(self): end_date = False for period in period_obj.browse( self.cr, self.uid, - self.localcontext['data']['period_ids'] + self.localcontext['data']['form']['period_ids'] ): period_end = datetime.strptime(period.date_stop, '%Y-%m-%d') if not end_date or end_date < period_end: @@ -171,11 +177,18 @@ def __init__(self, cr, uid, name, context): def set_context(self, objects, data, ids, report_type=None): self.localcontext.update({ - 'fiscal_page_base': data.get('fiscal_page_base'), + 'fiscal_page_base': data['form'].get('fiscal_page_base'), }) return super(Parser, self).set_context( objects, data, ids, report_type=report_type) + +class report_registro_iva_venidte(osv.AbstractModel): + _name = 'report.l10n_it_vat_registries.report_registro_iva_vendite' + _inherit = 'report.abstract_report' + _template = 'l10n_it_vat_registries.report_registro_iva_vendite' + _wrapped_report_class = Parser + report_sxw.report_sxw( 'report.registro_iva_vendite', 'registro_iva_vendite', diff --git a/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml index d1071b041c5f..a32d09b1b25e 100644 --- a/l10n_it_vat_registries/reports.xml +++ b/l10n_it_vat_registries/reports.xml @@ -1,6 +1,6 @@ - + Landscape A4 @@ -305,6 +305,17 @@ thead{ l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako + + diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index 77486176ad6b..fe42a13ffcd3 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -20,6 +20,7 @@ # from openerp import models, fields, api, _ +from openerp.exceptions import Warning class wizard_registro_iva(models.TransientModel): @@ -67,48 +68,35 @@ def _get_period(self): default=0, required=True) - @api.one - def print_registro(self): - move_obj = self.env['account.move'] - obj_model_data = self.env['ir.model.data'] - move_ids = move_obj.search([ - ('journal_id', 'in', [j.id for j in self.journal_ids]), - ('period_id', 'in', [p.id for p in self.period_ids]), + def print_registro(self, cr, uid, ids, context=None): + wizard = self.browse(cr, uid, ids[0], context=context) + move_obj = self.pool['account.move'] + move_ids = move_obj.search(cr, uid, [ + ('journal_id', 'in', [j.id for j in wizard.journal_ids]), + ('period_id', 'in', [p.id for p in wizard.period_ids]), ('state', '=', 'posted'), ], order='date, name') if not move_ids: - self.message = _('No documents found in the current selection') - model_data_ids = obj_model_data.search( - [('model', '=', 'ir.ui.view'), - ('name', '=', 'wizard_registro_iva')]) - return { - 'name': _('No documents'), - 'res_id': self.id, - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'wizard.registro.iva', - 'views': [(model_data_ids.res_id, 'form')], - 'context': self._context, - 'type': 'ir.actions.act_window', - 'target': 'new', - } - datas = {'ids': move_ids} - datas['model'] = 'account.move' - datas['fiscal_page_base'] = self.fiscal_page_base - datas['period_ids'] = [p.id for p in self.period_ids] - datas['layout'] = self.type - datas['tax_sign'] = self.tax_sign - res = { - 'type': 'ir.actions.report.xml', - 'datas': datas, + raise Warning(_('No documents found in the current selection')) + datas = {} + datas_form = {} + datas_form['fiscal_page_base'] = wizard.fiscal_page_base + datas_form['period_ids'] = [p.id for p in wizard.period_ids] + datas_form['tax_sign'] = wizard.tax_sign + report_name = "" + if wizard.type == 'customer': + report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' + elif wizard.type == 'supplier': + report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' + elif wizard.type == 'corrispettivi': + report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' + datas = { + 'ids': move_ids, + 'model': 'account.move', + 'form': datas_form } - if self.type == 'customer': - res['report_name'] = 'registro_iva_vendite' - elif self.type == 'supplier': - res.report_name = 'registro_iva_acquisti' - elif self.type == 'corrispettivi': - res['report_name'] = 'registro_iva_corrispettivi' - return res + return self.pool['report'].get_action( + cr, uid, [], report_name, data=datas, context=context) @api.onchange('type') def on_type_changed(self): From e41a0b9d0ec795a6455e8f7782cf06232c2f60e0 Mon Sep 17 00:00:00 2001 From: hurrinico Date: Thu, 4 Dec 2014 17:30:02 +0100 Subject: [PATCH 09/26] [FIX] Add new folder --- .../static/src/css/l10n_it_vat_registries.css | 12 +++++++ .../views/report_registro_iva_vendite.xml | 35 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 l10n_it_vat_registries/static/src/css/l10n_it_vat_registries.css create mode 100644 l10n_it_vat_registries/views/report_registro_iva_vendite.xml diff --git a/l10n_it_vat_registries/static/src/css/l10n_it_vat_registries.css b/l10n_it_vat_registries/static/src/css/l10n_it_vat_registries.css new file mode 100644 index 000000000000..7a739fb1e6a9 --- /dev/null +++ b/l10n_it_vat_registries/static/src/css/l10n_it_vat_registries.css @@ -0,0 +1,12 @@ +.left_with_line { + text-align:left; vertical-align:text-top; border-top:1px solid #000; padding:5px +} +.right_with_line { + text-align:right; vertical-align:text-top; border-top:1px solid #000; padding:5px +} +.left_without_line { + text-align:left; vertical-align:text-top; padding:5px +} +.right_without_line { + text-align:right; vertical-align:text-top; padding:5px +} \ No newline at end of file diff --git a/l10n_it_vat_registries/views/report_registro_iva_vendite.xml b/l10n_it_vat_registries/views/report_registro_iva_vendite.xml new file mode 100644 index 000000000000..86d7bed322ac --- /dev/null +++ b/l10n_it_vat_registries/views/report_registro_iva_vendite.xml @@ -0,0 +1,35 @@ + + + + + + + From e251b724b00453b820d9384f533167f6b5fdd3c3 Mon Sep 17 00:00:00 2001 From: hurrinico Date: Wed, 17 Dec 2014 17:56:54 +0100 Subject: [PATCH 10/26] [FIX] fix sales --- l10n_it_vat_registries/__openerp__.py | 3 +- l10n_it_vat_registries/invoice.py | 12 +- l10n_it_vat_registries/reports.xml | 14 +- .../views/report_registro_iva_acquisti.xml | 24 ++++ .../report_registro_iva_corrispettivi.xml | 0 .../views/report_registro_iva_vendite.xml | 132 +++++++++++++++--- .../wizard/print_registro_iva.py | 4 +- 7 files changed, 164 insertions(+), 25 deletions(-) create mode 100644 l10n_it_vat_registries/views/report_registro_iva_acquisti.xml create mode 100644 l10n_it_vat_registries/views/report_registro_iva_corrispettivi.xml diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 6c676e376a57..fd3913a507f1 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -39,7 +39,8 @@ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', - 'views/report_registro_iva_vendite.xml' + 'views/report_registro_iva_vendite.xml', + 'views/report_registro_iva_acquisti.xml' ], "active": False, "installable": True diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index 9360d8a7d103..ea0bdaf40458 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -48,7 +48,8 @@ def _tax_amounts_by_code(self, move): return res def _get_move(self, move_ids): - move_list = self.pool.get('account.move').browse(self.cr, self.uid, move_ids) + move_list = self.pool.get( + 'account.move').browse(self.cr, self.uid, move_ids) return move_list def _get_tax_lines(self, move): @@ -58,7 +59,6 @@ def _get_tax_lines(self, move): # sono più codici IVA index = 0 invoice = False - import pdb; pdb.set_trace() for move_line in move.line_id: if move_line.invoice: if invoice and invoice.id != move_line.invoice.id: @@ -166,6 +166,7 @@ def _get_end_date(self): def __init__(self, cr, uid, name, context): super(Parser, self).__init__(cr, uid, name, context) self.localcontext.update({ + 'get_move': self._get_move, 'tax_lines': self._get_tax_lines, 'tax_codes': self._get_tax_codes, 'tax_codes_totals': self._get_tax_codes_totals, @@ -189,6 +190,13 @@ class report_registro_iva_venidte(osv.AbstractModel): _template = 'l10n_it_vat_registries.report_registro_iva_vendite' _wrapped_report_class = Parser + +class report_registro_iva_acquisti(osv.AbstractModel): + _name = 'report.l10n_it_vat_registries.report_registro_iva_acquisti' + _inherit = 'report.abstract_report' + _template = 'l10n_it_vat_registries.report_registro_iva_acquisti' + _wrapped_report_class = Parser + report_sxw.report_sxw( 'report.registro_iva_vendite', 'registro_iva_vendite', diff --git a/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml index a32d09b1b25e..a80dc8d4f677 100644 --- a/l10n_it_vat_registries/reports.xml +++ b/l10n_it_vat_registries/reports.xml @@ -1,6 +1,6 @@ - + Landscape A4 @@ -309,13 +309,23 @@ thead{ + diff --git a/l10n_it_vat_registries/views/report_registro_iva_acquisti.xml b/l10n_it_vat_registries/views/report_registro_iva_acquisti.xml new file mode 100644 index 000000000000..478d609da7a1 --- /dev/null +++ b/l10n_it_vat_registries/views/report_registro_iva_acquisti.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/l10n_it_vat_registries/views/report_registro_iva_corrispettivi.xml b/l10n_it_vat_registries/views/report_registro_iva_corrispettivi.xml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/l10n_it_vat_registries/views/report_registro_iva_vendite.xml b/l10n_it_vat_registries/views/report_registro_iva_vendite.xml index 86d7bed322ac..58b78263ba99 100644 --- a/l10n_it_vat_registries/views/report_registro_iva_vendite.xml +++ b/l10n_it_vat_registries/views/report_registro_iva_vendite.xml @@ -3,33 +3,127 @@ - + \ No newline at end of file diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index fe42a13ffcd3..a1fbcd581cd5 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -84,8 +84,10 @@ def print_registro(self, cr, uid, ids, context=None): datas_form['period_ids'] = [p.id for p in wizard.period_ids] datas_form['tax_sign'] = wizard.tax_sign report_name = "" + # vendite if wizard.type == 'customer': - report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' + report_name = 'l10n_it_vat_registries.report_registro_iva_acquisti' + # acquisti elif wizard.type == 'supplier': report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' elif wizard.type == 'corrispettivi': From 0651632f9b1f6cf8660b22c380ff789ef1313c50 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Thu, 18 Dec 2014 12:14:52 +0100 Subject: [PATCH 11/26] [DEL] mako stuff --- l10n_it_vat_registries/invoice.py | 16 -- l10n_it_vat_registries/reports.xml | 305 ----------------------------- 2 files changed, 321 deletions(-) diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index ea0bdaf40458..e347f104d333 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -196,19 +196,3 @@ class report_registro_iva_acquisti(osv.AbstractModel): _inherit = 'report.abstract_report' _template = 'l10n_it_vat_registries.report_registro_iva_acquisti' _wrapped_report_class = Parser - -report_sxw.report_sxw( - 'report.registro_iva_vendite', - 'registro_iva_vendite', - 'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako', - parser=Parser) -report_sxw.report_sxw( - 'report.registro_iva_acquisti', - 'registro_iva_acquisti', - 'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako', - parser=Parser) -report_sxw.report_sxw( - 'report.registro_iva_corrispettivi', - 'registro_iva_corrispettivi', - 'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako', - parser=Parser) diff --git a/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml index a80dc8d4f677..52521830012a 100644 --- a/l10n_it_vat_registries/reports.xml +++ b/l10n_it_vat_registries/reports.xml @@ -1,311 +1,6 @@ - - Landscape - A4 - 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Registro I.V.A. Vendite
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n} -
- -]]> -
- - - - - - - - - - -
Page ${objects[0].period_id and objects[0].period_id.fiscalyear_id and objects[0].period_id.fiscalyear_id.name or ''|entity}/
- -]]>
- Registro IVA vendite -
- - Landscape - A4 - 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Registro I.V.A. Acquisti
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n} -
- -]]> -
- - - - - - - - - - -
Page ${objects[0].period_id and objects[0].period_id.fiscalyear_id and objects[0].period_id.fiscalyear_id.name or ''|entity}/
- -]]>
- Registro IVA acquisti -
- - Landscape - A4 - 60 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Registro I.V.A. Corrispettivi
${company.partner_id.name or ''|entity}
${company.partner_id.street or ''|entity}
${company.partner_id.street2 or ''|entity}P. IVA: ${company.partner_id.vat or ''|entity}
${company.partner_id.zip or ''|entity}Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}
${company.partner_id.city or ''|entity}Codice Attività:
${company.partner_id.province and company.partner_id.province.code or ''|entity}Registro Imprese:
${_debug or ''|n} -
- -]]> -
- - - - - - - - - - -
Page ${objects[0].period_id and objects[0].period_id.fiscalyear_id and objects[0].period_id.fiscalyear_id.name or ''|entity}/
- -]]>
- Registro IVA corrispettivi -
- - - Customer Invoices VAT Registry - ir.actions.report.xml - account.move - registro_iva_vendite - webkit - l10n_it_vat_registries/templates/registro_iva_vendite.mako - - - - Supplier Invoices VAT Registry - ir.actions.report.xml - account.move - registro_iva_acquisti - webkit - l10n_it_vat_registries/templates/registro_iva_acquisti.mako - - - - Corrispettivi VAT Registry - ir.actions.report.xml - account.move - registro_iva_corrispettivi - webkit - l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako - - - Date: Thu, 18 Dec 2014 12:53:20 +0100 Subject: [PATCH 12/26] [IMP] copyright --- l10n_it_vat_registries/AUTHORS.txt | 2 -- l10n_it_vat_registries/__init__.py | 2 ++ l10n_it_vat_registries/__openerp__.py | 7 ++++--- l10n_it_vat_registries/account.py | 2 ++ l10n_it_vat_registries/invoice.py | 2 ++ l10n_it_vat_registries/wizard/__init__.py | 2 ++ l10n_it_vat_registries/wizard/print_registro_iva.py | 6 ++++-- 7 files changed, 16 insertions(+), 7 deletions(-) delete mode 100644 l10n_it_vat_registries/AUTHORS.txt diff --git a/l10n_it_vat_registries/AUTHORS.txt b/l10n_it_vat_registries/AUTHORS.txt deleted file mode 100644 index 36cb2a1a1b05..000000000000 --- a/l10n_it_vat_registries/AUTHORS.txt +++ /dev/null @@ -1,2 +0,0 @@ -Lorenzo Battistini -Ingrid Barcaro diff --git a/l10n_it_vat_registries/__init__.py b/l10n_it_vat_registries/__init__.py index 32d34e3d4beb..376a9b158e67 100644 --- a/l10n_it_vat_registries/__init__.py +++ b/l10n_it_vat_registries/__init__.py @@ -3,6 +3,8 @@ # # Copyright (C) 2011-2013 Associazione OpenERP Italia # (). +# Copyright (C) 2014 Agile Business Group sagl +# () # # 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 diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index fd3913a507f1..0ce1e816318d 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -3,8 +3,9 @@ # # Copyright (C) 2011-2013 Associazione OpenERP Italia # (). -# Copyright (C) 2012 Agile Business Group sagl () # Copyright (C) 2012 Domsense srl () +# Copyright (C) 2012-2014 Agile Business Group sagl +# () # # 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 @@ -27,8 +28,8 @@ 'description': """Accounting reports for Italian localization - VAT Registries http://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""", - 'author': 'OpenERP Italian Community', - 'website': 'http://www.openerp-italia.org', + 'author': 'Agile Business Group', + 'website': 'http://www.agilebg.com', 'license': 'AGPL-3', "depends": [ 'report_webkit', diff --git a/l10n_it_vat_registries/account.py b/l10n_it_vat_registries/account.py index 8729f2f70aec..97ee483d363f 100644 --- a/l10n_it_vat_registries/account.py +++ b/l10n_it_vat_registries/account.py @@ -3,6 +3,8 @@ # # Copyright (C) 2013 Associazione OpenERP Italia # (). +# Copyright (C) 2014 Agile Business Group sagl +# () # # 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 diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/invoice.py index e347f104d333..f0ab0c76b2fb 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/invoice.py @@ -3,6 +3,8 @@ # # Copyright (C) 2011-2013 Associazione OpenERP Italia # (). +# Copyright (C) 2014 Agile Business Group sagl +# () # # 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 diff --git a/l10n_it_vat_registries/wizard/__init__.py b/l10n_it_vat_registries/wizard/__init__.py index 06bd30ce766d..99bc84d225fb 100644 --- a/l10n_it_vat_registries/wizard/__init__.py +++ b/l10n_it_vat_registries/wizard/__init__.py @@ -3,6 +3,8 @@ # # Copyright (C) 2011-2013 Associazione OpenERP Italia # (). +# Copyright (C) 2014 Agile Business Group sagl +# () # # 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 diff --git a/l10n_it_vat_registries/wizard/print_registro_iva.py b/l10n_it_vat_registries/wizard/print_registro_iva.py index a1fbcd581cd5..ec61eeb50897 100644 --- a/l10n_it_vat_registries/wizard/print_registro_iva.py +++ b/l10n_it_vat_registries/wizard/print_registro_iva.py @@ -3,6 +3,8 @@ # # Copyright (C) 2011 Associazione OpenERP Italia # (). +# Copyright (C) 2014 Agile Business Group sagl +# () # # 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 @@ -86,10 +88,10 @@ def print_registro(self, cr, uid, ids, context=None): report_name = "" # vendite if wizard.type == 'customer': - report_name = 'l10n_it_vat_registries.report_registro_iva_acquisti' + report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' # acquisti elif wizard.type == 'supplier': - report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' + report_name = 'l10n_it_vat_registries.report_registro_iva_acquisti' elif wizard.type == 'corrispettivi': report_name = 'l10n_it_vat_registries.report_registro_iva_vendite' datas = { From cf982514b4459d472c125d7aa5f29af76368d7c3 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Thu, 18 Dec 2014 15:14:19 +0100 Subject: [PATCH 13/26] [REF] structure --- l10n_it_vat_registries/__init__.py | 2 +- l10n_it_vat_registries/__openerp__.py | 3 +-- l10n_it_vat_registries/reports.xml | 16 +++---------- .../{invoice.py => vat_registry.py} | 12 +++------- ...va_vendite.xml => report_registro_iva.xml} | 7 ++++-- .../views/report_registro_iva_acquisti.xml | 24 ------------------- .../report_registro_iva_corrispettivi.xml | 0 .../wizard/print_registro_iva.py | 11 ++------- 8 files changed, 15 insertions(+), 60 deletions(-) rename l10n_it_vat_registries/{invoice.py => vat_registry.py} (94%) rename l10n_it_vat_registries/views/{report_registro_iva_vendite.xml => report_registro_iva.xml} (97%) delete mode 100644 l10n_it_vat_registries/views/report_registro_iva_acquisti.xml delete mode 100644 l10n_it_vat_registries/views/report_registro_iva_corrispettivi.xml diff --git a/l10n_it_vat_registries/__init__.py b/l10n_it_vat_registries/__init__.py index 376a9b158e67..a43e6c2b6a93 100644 --- a/l10n_it_vat_registries/__init__.py +++ b/l10n_it_vat_registries/__init__.py @@ -22,5 +22,5 @@ # from . import wizard -from . import invoice +from . import vat_registry from . import account diff --git a/l10n_it_vat_registries/__openerp__.py b/l10n_it_vat_registries/__openerp__.py index 0ce1e816318d..a4401b56d796 100644 --- a/l10n_it_vat_registries/__openerp__.py +++ b/l10n_it_vat_registries/__openerp__.py @@ -40,8 +40,7 @@ 'reports.xml', 'wizard/print_registro_iva.xml', 'account_view.xml', - 'views/report_registro_iva_vendite.xml', - 'views/report_registro_iva_acquisti.xml' + 'views/report_registro_iva.xml', ], "active": False, "installable": True diff --git a/l10n_it_vat_registries/reports.xml b/l10n_it_vat_registries/reports.xml index 52521830012a..2c06e8292375 100644 --- a/l10n_it_vat_registries/reports.xml +++ b/l10n_it_vat_registries/reports.xml @@ -2,22 +2,12 @@ - diff --git a/l10n_it_vat_registries/invoice.py b/l10n_it_vat_registries/vat_registry.py similarity index 94% rename from l10n_it_vat_registries/invoice.py rename to l10n_it_vat_registries/vat_registry.py index f0ab0c76b2fb..e87157783090 100644 --- a/l10n_it_vat_registries/invoice.py +++ b/l10n_it_vat_registries/vat_registry.py @@ -181,20 +181,14 @@ def __init__(self, cr, uid, name, context): def set_context(self, objects, data, ids, report_type=None): self.localcontext.update({ 'fiscal_page_base': data['form'].get('fiscal_page_base'), + 'registry_type': data['form'].get('registry_type'), }) return super(Parser, self).set_context( objects, data, ids, report_type=report_type) class report_registro_iva_venidte(osv.AbstractModel): - _name = 'report.l10n_it_vat_registries.report_registro_iva_vendite' + _name = 'report.l10n_it_vat_registries.report_registro_iva' _inherit = 'report.abstract_report' - _template = 'l10n_it_vat_registries.report_registro_iva_vendite' - _wrapped_report_class = Parser - - -class report_registro_iva_acquisti(osv.AbstractModel): - _name = 'report.l10n_it_vat_registries.report_registro_iva_acquisti' - _inherit = 'report.abstract_report' - _template = 'l10n_it_vat_registries.report_registro_iva_acquisti' + _template = 'l10n_it_vat_registries.report_registro_iva' _wrapped_report_class = Parser diff --git a/l10n_it_vat_registries/views/report_registro_iva_vendite.xml b/l10n_it_vat_registries/views/report_registro_iva.xml similarity index 97% rename from l10n_it_vat_registries/views/report_registro_iva_vendite.xml rename to l10n_it_vat_registries/views/report_registro_iva.xml index 58b78263ba99..7cd9cfeecb92 100644 --- a/l10n_it_vat_registries/views/report_registro_iva_vendite.xml +++ b/l10n_it_vat_registries/views/report_registro_iva.xml @@ -6,7 +6,7 @@ -