avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00858
Re: [Merge] lp:~avanzosc-security-team/avanzosc/dos_vat_clearance_report into lp:~avanzosc-security-team/avanzosc/72horas
Comentario inline, acerca del uno de los cambios ;)
He probado y he instalado
Diff comments:
> === modified file 'dos_vat_clearance_report/__init__.py'
> --- dos_vat_clearance_report/__init__.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/__init__.py 2014-07-10 09:56:24 +0000
> @@ -21,6 +21,6 @@
> #
> ##############################################################################
>
> -import account_tax_code
> -import report
> -import wizard
> +from . import models
> +from . import report
> +from . import wizard
>
> === modified file 'dos_vat_clearance_report/__openerp__.py'
> --- dos_vat_clearance_report/__openerp__.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/__openerp__.py 2014-07-10 09:56:24 +0000
> @@ -21,26 +21,25 @@
> #
> ##############################################################################
> {
> - "name" : "VAT Clearance Report",
> - "version" : "1.0",
> - "author" : "DOS",
> - "website" : "www.dos-sl.es",
> - "license" : "GPL-3",
> - "depends" : ["account"],
> - "category" : "Accounting",
> - "description": """
> -Add some common financial/accounting reports and some wizards to quickly compute them:
> + "name": "VAT Clearance Report",
> + "version": "1.0",
> + "author": "DOS",
> + "website": "www.dos-sl.es",
> + "license": "GPL-3",
> + "depends": ["account"],
> + "category": "Accounting",
> + "description": """
> +Add some common financial/accounting reports """
> + """and some wizards to quickly compute them:
> * VAT clearance
>
> -They can be found in the "Financial Management/Legal Statements/Generic Reports" menu.
> +They can be found in the "Financial Management/Legal"""
> + """ Statements/Generic Reports" menu.
> """,
> - "init_xml" : [],
> - "demo_xml" : [],
> - "update_xml" : [
> - "account_tax_code_view.xml",
> - "account_report_report.xml",
> - "account_report_wizard.xml",
> - ],
> - "active": False,
> - "installable": True
> + "data": [
> + "views/account_tax_code_view.xml",
> + "report/account_report_report.xml",
> + "wizard/account_report_wizard.xml",
> + ],
> + "installable": True
> }
>
> === removed file 'dos_vat_clearance_report/i18n/es.po'
> --- dos_vat_clearance_report/i18n/es.po 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/i18n/es.po 1970-01-01 00:00:00 +0000
> @@ -1,282 +0,0 @@
Eliminamos el .po porque al instalar da errores de UTF, habrá que regenerarlo
> -# Translation of OpenERP Server.
> -# This file contains the translation of the following modules:
> -# * dos_vat_clearance_report
> -#
> -msgid ""
> -msgstr ""
> -"Project-Id-Version: OpenERP Server 6.0.1\n"
> -"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
> -"POT-Creation-Date: 2012-11-05 11:14+0000\n"
> -"PO-Revision-Date: 2012-11-05 11:14+0000\n"
> -"Last-Translator: <>\n"
> -"Language-Team: \n"
> -"MIME-Version: 1.0\n"
> -"Content-Type: text/plain; charset=UTF-8\n"
> -"Content-Transfer-Encoding: \n"
> -"Plural-Forms: \n"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,in_invoice:0
> -msgid "Supplier invoices"
> -msgstr "Facturas proveedor"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,in_refund:0
> -msgid "Supplier refunds"
> -msgstr "Facturas rectificativas de Proveedor (Abonos)"
> -
> -#. module: dos_vat_clearance_report
> -#: model:ir.model,name:dos_vat_clearance_report.model_account_tax_code
> -msgid "Tax Code"
> -msgstr "Código impuesto"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Date Filter"
> -msgstr "Filtrado por fechas"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,draft:0
> -msgid "Draft"
> -msgstr "Borrador"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "OUTPUT VAT"
> -msgstr "IVA REPERCUTIDO"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,date_from:0
> -msgid "Start date"
> -msgstr "Fecha inicial"
> -
> -#. module: dos_vat_clearance_report
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:260
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:270
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:282
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:292
> -#, python-format
> -msgid "TO RETURNED"
> -msgstr "A DEVOLVER"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Filter on Periods"
> -msgstr "Filtrado por períodos"
> -
> -#. module: dos_vat_clearance_report
> -#: code:addons/dos_vat_clearance_report/wizard/wizard_vat_clearance_report.py:95
> -#, python-format
> -msgid "Listado de liquidación de IVA"
> -msgstr "Listado de liquidación de IVA"
> -
> -#. module: dos_vat_clearance_report
> -#: model:ir.actions.wizard,name:dos_vat_clearance_report.wizard_vat_clearance_report
> -#: model:ir.ui.menu,name:dos_vat_clearance_report.menu_vat_clearance_report
> -msgid "Print Vat Clearance List"
> -msgstr "Imprimir listado de liquidación de IVA"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,proforma:0
> -msgid "Pro-forma"
> -msgstr "Pro-forma"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,out_refund:0
> -msgid "Customer refunds"
> -msgstr "Facturas rectificativas de Cliente (Abonos)"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,company_id:0
> -msgid "Company"
> -msgstr "Compañía"
> -
> -#. module: dos_vat_clearance_report
> -#: selection:account.vat.clearance.report,init,state:0
> -msgid "By Period"
> -msgstr "Por período"
> -
> -#. module: dos_vat_clearance_report
> -#: selection:account.vat.clearance.report,init,state:0
> -msgid "No Filter"
> -msgstr "No filtrar"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Quota"
> -msgstr "Cuota"
> -
> -#. module: dos_vat_clearance_report
> -#: help:account.vat.clearance.report,init,periods:0
> -msgid "All periods if empty"
> -msgstr "Todos los períodos están vacíos"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Base"
> -msgstr "Base"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Filter by date (default current year)"
> -msgstr "Filtrar por fecha (por defecto año actual)"
> -
> -#. module: dos_vat_clearance_report
> -#: help:account.tax.code,irpf:0
> -msgid "Check this box if tax code is IRPF"
> -msgstr "Marcar esta casilla si el código de impuesto es IRPF"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Vat Clearance List"
> -msgstr "Listado de Liquidación de IVA"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "INPUT VAT"
> -msgstr "IVA SOPORTADO"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "End of report"
> -msgstr "Final del informe"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,report_name:0
> -msgid "Report Name"
> -msgstr "Nombre del listado"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Name"
> -msgstr "Nombre"
> -
> -#. module: dos_vat_clearance_report
> -#: selection:account.vat.clearance.report,init,state:0
> -msgid "By Date and Period"
> -msgstr "Por fecha y período"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,out_invoice:0
> -msgid "Customer invoices"
> -msgstr "Facturas cliente"
> -
> -#. module: dos_vat_clearance_report
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:260
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:270
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:282
> -#: code:addons/dos_vat_clearance_report/report/vat_clearance_list.py:292
> -#, python-format
> -msgid "TO ENTERED"
> -msgstr "A INGRESAR"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "0.8cm 19.8cm 28.8cm 19.8cm"
> -msgstr "0.8cm 19.8cm 28.8cm 19.8cm"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Currency :"
> -msgstr "Moneda :"
> -
> -#. module: dos_vat_clearance_report
> -#: selection:account.vat.clearance.report,init,state:0
> -msgid "By Date"
> -msgstr "Por fecha"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,vat_taxes:0
> -msgid "VAT taxes"
> -msgstr "Impuestos IVA"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,cancel:0
> -msgid "Cancelled"
> -msgstr "Cancelada"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "DIFFERENCE"
> -msgstr "DIFERENCIA"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Options"
> -msgstr "Opciones"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,irpf_taxes:0
> -msgid "IRPF taxes"
> -msgstr "Impuestos IRPF"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Filter by state"
> -msgstr "Filtrar por estado"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,date_to:0
> -msgid "End date"
> -msgstr "Fecha final"
> -
> -#. module: dos_vat_clearance_report
> -#: field:account.tax.code,irpf:0
> -msgid "IRPF"
> -msgstr "IRPF"
> -
> -#. module: dos_vat_clearance_report
> -#: constraint:account.tax.code:0
> -msgid "Error ! You can not create recursive accounts."
> -msgstr "¡Error! No se pueden crear cuentas recursivas."
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_button:account.vat.clearance.report,init,report:0
> -msgid "Print"
> -msgstr "Imprimir"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Page"
> -msgstr "Página"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,state:0
> -msgid "Date/Period Filter"
> -msgstr "Filtrar por fecha/período"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,paid:0
> -msgid "Done"
> -msgstr "Pagada"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,periods:0
> -msgid "Periods"
> -msgstr "Períodos"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_view:account.vat.clearance.report,init:0
> -msgid "Filter by type"
> -msgstr "Filtrar por tipo"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_button:account.vat.clearance.report,init,end:0
> -msgid "Cancel"
> -msgstr "Cancelar"
> -
> -#. module: dos_vat_clearance_report
> -#: report:account.vat.clearance.report:0
> -msgid "Total"
> -msgstr "Total"
> -
> -#. module: dos_vat_clearance_report
> -#: wizard_field:account.vat.clearance.report,init,open:0
> -msgid "Open"
> -msgstr "Abierta"
> -
> -#. module: dos_vat_clearance_report
> -#: model:ir.actions.report.xml,name:dos_vat_clearance_report.account_vat_clearance_report
> -msgid "VAT Clearance List"
> -msgstr "Listado de Liquidación de IVA"
> -
>
> === added directory 'dos_vat_clearance_report/models'
> === added file 'dos_vat_clearance_report/models/__init__.py'
> --- dos_vat_clearance_report/models/__init__.py 1970-01-01 00:00:00 +0000
> +++ dos_vat_clearance_report/models/__init__.py 2014-07-10 09:56:24 +0000
> @@ -0,0 +1,24 @@
> +# -*- encoding: utf-8 -*-
> +##############################################################################
> +#
> +# OpenERP, Open Source Management Solution
> +# Copyright (c) 2012 DOS (http://www.dos-sl.es) All Rights Reserved.
> +#
> +# $Id$
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU 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 General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +
> +from . import account_tax_code
>
> === renamed file 'dos_vat_clearance_report/account_tax_code.py' => 'dos_vat_clearance_report/models/account_tax_code.py'
> --- dos_vat_clearance_report/account_tax_code.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/models/account_tax_code.py 2014-07-10 09:56:24 +0000
> @@ -21,23 +21,16 @@
> #
> ##############################################################################
>
> -from osv import fields,osv
> -
> -class account_tax_code(osv.osv):
> -
> - _inherit = 'account.tax.code'
> -
> - _columns = {
> - 'irpf' : fields.boolean('IRPF', help="Check this box if tax code is IRPF"),
> - }
> -
> - _defaults = {
> - 'irpf': False,
> - }
> -
> -account_tax_code()
> -
> -
> -
> -
> -
> +from openerp.osv import fields, orm
> +
> +
> +class AccountTaxCode(orm.Model):
> +
> + _inherit = 'account.tax.code'
> + _columns = {
> + 'irpf': fields.boolean('IRPF',
> + help="Check this box if tax code is IRPF"),
> + }
> + _defaults = {
> + 'irpf': False,
> + }
>
> === modified file 'dos_vat_clearance_report/report/__init__.py'
> --- dos_vat_clearance_report/report/__init__.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/report/__init__.py 2014-07-10 09:56:24 +0000
> @@ -21,5 +21,5 @@
> #
> ##############################################################################
>
> -import vat_clearance_list
> +from . import vat_clearance_list
>
>
> === renamed file 'dos_vat_clearance_report/account_report_report.xml' => 'dos_vat_clearance_report/report/account_report_report.xml'
> === modified file 'dos_vat_clearance_report/report/rml_parse.py'
> --- dos_vat_clearance_report/report/rml_parse.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/report/rml_parse.py 2014-07-10 09:56:24 +0000
> @@ -21,66 +21,68 @@
> #
> ##############################################################################
>
> -from report import report_sxw
> +from openerp.report import report_sxw
> import xml.dom.minidom
> -import os, time
> -import osv
> +import os
> +import time
> import re
> -import tools
> -import pooler
> import re
> import sys
>
>
> -class rml_parse(report_sxw.rml_parse):
> +class RmlParse(report_sxw.rml_parse):
>
> def __init__(self, cr, uid, name, context):
> - super(rml_parse, self).__init__(cr, uid, name, context=None)
> + super(RmlParse, self).__init__(cr, uid, name, context=None)
> self.localcontext.update({
> 'comma_me': self.comma_me,
> 'format_date': self._get_and_change_date_format_for_swiss,
> - 'strip_name' : self._strip_name,
> - 'explode_name' : self._explode_name,
> + 'strip_name': self._strip_name,
> + 'explode_name': self._explode_name,
> })
>
> - def comma_me(self,amount):
> + def comma_me(self, amount):
> if not amount:
> amount = 0.0
> - if type(amount) is float :
> - amount = str('%.2f'%amount)
> - else :
> + if type(amount) is float:
> + amount = str('%.2f' % amount)
> + else:
> amount = str(amount)
> if (amount == '0'):
> - return ' '
> + return ' '
> orig = amount
> new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
> if orig == new:
> return new
> else:
> return self.comma_me(new)
> - def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
> +
> + def _ellipsis(self, string, maxlen=100, ellipsis='...'):
> ellipsis = ellipsis or ''
> try:
> - return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
> + return string[
> + :maxlen - len(ellipsis)] + (ellipsis, '')[len(string) < maxlen]
> except Exception, e:
> return False
> +
> def _strip_name(self, name, maxlen=50):
> return self._ellipsis(name, maxlen, '...')
> -
> - def _get_and_change_date_format_for_swiss (self,date_to_format):
> - date_formatted=''
> +
> + def _get_and_change_date_format_for_swiss(self, date_to_format):
> + date_formatted = ''
> if date_to_format:
> - date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
> + date_formatted = (
> + strptime(date_to_format, '%Y-%m-%d').strftime('%d.%m.%Y'))
> return date_formatted
> -
> - def _explode_name(self,chaine,length):
> +
> + def _explode_name(self, chaine, length):
> # We will test if the size is less then account
> full_string = ''
> if (len(str(chaine)) <= length):
> return chaine
> #
> else:
> - chaine = unicode(chaine,'utf8').encode('iso-8859-1')
> + chaine = unicode(chaine, 'utf8').encode('iso-8859-1')
> rup = 0
> for carac in chaine:
> rup = rup + 1
> @@ -90,10 +92,9 @@
> rup = 0
> else:
> full_string = full_string + carac
> -
> return full_string
> -
> - def makeAscii(self,str):
> +
> + def makeAscii(self, str):
> try:
> Stringer = str.encode("utf-8")
> except UnicodeDecodeError:
> @@ -106,17 +107,19 @@
> else:
> return Stringer
> return Stringer
> - def explode_this(self,chaine,length):
> - #chaine = self.repair_string(chaine)
> +
> + def explode_this(self, chaine, length):
> + # chaine = self.repair_string(chaine)
> chaine = rstrip(chaine)
> ast = list(chaine)
> i = length
> while i <= len(ast):
> - ast.insert(i,'\n')
> + ast.insert(i, '\n')
> i = i + length
> chaine = str("".join(ast))
> return chaine
> - def repair_string(self,chaine):
> +
> + def repair_string(self, chaine):
> ast = list(chaine)
> UnicodeAst = []
> _previouslyfound = False
> @@ -129,28 +132,25 @@
> to_reencode = elem + ast[i+1]
> Good_char = to_reencode.decode('utf-8')
> UnicodeAst.append(Good_char)
> - i += i +2
> + i += i + 2
> else:
> UnicodeAst.append(elem)
> i += i + 1
> -
> -
> return "".join(UnicodeAst)
> -
> - def ReencodeAscii(self,str):
> +
> + def ReencodeAscii(self, str):
> try:
> Stringer = str.decode("ascii")
> except UnicodeEncodeError:
> return str.encode("ascii")
> except UnicodeDecodeError:
> return str.encode("ascii")
> -
> else:
> return Stringer
>
> -
> # def _add_header(self, node):
> - # rml_head = tools.file_open('specific_param/report/header/corporate_rml_header_ch.rml').read()
> + # rml_head = tools.file_open(
> + # 'specific_param/report/header/corporate_rml_header_ch.rml').read()
> # head_dom = xml.dom.minidom.parseString(rml_head)
> # #for frame in head_dom.getElementsByTagName('frame'):
> # # frame.parentNode.removeChild(frame)
> @@ -160,13 +160,11 @@
> # found = self._find_node(node, tag.localName)
> # # rml_frames = found.getElementsByTagName('frame')
> # if found:
> - # if tag.hasAttribute('position') and (tag.getAttribute('position')=='inside'):
> + # if (tag.hasAttribute('position') and
> + # (tag.getAttribute('position')=='inside')):
> # found.appendChild(tag)
> # else:
> # found.parentNode.replaceChild(tag, found)
> # # for frame in rml_frames:
> # # tag.appendChild(frame)
> # return True
> -
> -
> -
>
> === modified file 'dos_vat_clearance_report/report/vat_clearance_list.py'
> --- dos_vat_clearance_report/report/vat_clearance_list.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/report/vat_clearance_list.py 2014-07-10 09:56:24 +0000
> @@ -23,280 +23,298 @@
>
> import time
> from mx.DateTime import *
> -from report import report_sxw
> -import xml
> -import rml_parse
> -import pooler
> -from tools.translate import _
> -
> -class print_vat_clearance_list(rml_parse.rml_parse):
> - """ Report that print invoices grouped by currency and type """
> - _name = 'report.account.print_vat_clearance_list'
> -
> -
> - def __init__(self, cr, uid, name, context):
> - super(print_vat_clearance_list, self).__init__(cr, uid, name, context)
> - #contain tuples of in invoices : (curreny, [browse records], currency_untaxed, currency_tax, currency_total)
> - self.in_invoices = []
> -
> - #contain tuples of out invoices : (curreny, [browse records], currency_untaxed, currency_tax, currency_total)
> - self.out_invoices = []
> -
> - #contain difference
> - self.differences = []
> -
> - self.localcontext.update({
> - 'time': time,
> - 'in_invoices': self.in_invoices,
> - 'out_invoices': self.out_invoices,
> - 'differences': self.differences,
> - 'vat_taxes': False,
> - 'irpf_taxes': False,
> - 'report_name': '',
> - })
> -
> -
> - def set_context(self, objects, data, ids, report_type = None):
> - """We do the grouping and proccessing of invoices"""
> - invoice_obj = self.pool.get('account.invoice')
> -
> - if data['model'] == 'ir.ui.menu':
> - invoice_types = []
> - if data['form']['out_invoice']:
> - invoice_types.append('out_invoice')
> - if data['form']['out_refund']:
> - invoice_types.append('out_refund')
> - if data['form']['in_invoice']:
> - invoice_types.append('in_invoice')
> - if data['form']['in_refund']:
> - invoice_types.append('in_refund')
> - invoice_states = []
> - if data['form']['draft']:
> - invoice_states.append('draft')
> - if data['form']['proforma']:
> - invoice_states.append('proforma')
> - invoice_states.append('proforma2')
> - if data['form']['open']:
> - invoice_states.append('open')
> - if data['form']['paid']:
> - invoice_states.append('paid')
> - if data['form']['cancel']:
> - invoice_states.append('cancel')
> - where = [('company_id','=',data['form']['company_id']),('type','in',invoice_types),('state','in',invoice_states)]
> - if data['form']['state'] in ['byperiod','all']:
> - period_ids = data['form']['periods'][0][2]
> - periods = ','.join([str(id) for id in period_ids])
> - where.append(('period_id','in',period_ids))
> - if data['form']['state'] in ['bydate','all','none']:
> - where.append(('date_invoice','>=',data['form']['date_from']))
> - where.append(('date_invoice','<=',data['form']['date_to']))
> - #print where
> - ids = invoice_obj.search(self.cr, self.uid, where)
> - objects = invoice_obj.browse(self.cr, self.uid, ids)
> -
> - self.localcontext.update({
> - 'vat_taxes': data['form'].get('vat_taxes'),
> - 'irpf_taxes': data['form'].get('irpf_taxes'),
> - 'report_name': data['form'].get('report_name'),
> - })
> -
> - vat_taxes = data['form'].get('vat_taxes') or False
> - irpf_taxes = data['form'].get('irpf_taxes') or False
> -
> - if not ids :
> - return super(print_vat_clearance_list, self).set_context(objects, data, ids, report_type)
> -
> - if not isinstance(ids, list) :
> - ids = [ids]
> - # we create temp list that will be used for store invoices by type
> - ininv = []
> - outinv = []
> -
> - # we get the invoices and sort them by types
> - invoices = invoice_obj.browse(self.cr, self.uid, ids)
> - for inv in invoices :
> - if inv.type in ('in_invoice', 'in_refund'):
> - ininv.append(inv)
> - if inv.type in ('out_invoice', 'out_refund'):
> - outinv.append(inv)
> -
> - # we process the invoice and attribute them to the property
> - self.filter_invoices(outinv, self.out_invoices, vat_taxes, irpf_taxes)
> - self.filter_invoices(ininv, self.in_invoices, vat_taxes, irpf_taxes)
> - if not irpf_taxes:
> - self.calculate_differences(self.differences, self.in_invoices, self.out_invoices)
> - super(print_vat_clearance_list, self).set_context(objects, data, ids, report_type)
> -
> -
> - def filter_invoices(self, list, dest, vat_taxes=False, irpf_taxes=False):
> - if not list :
> - return
> - tmp = {}
> -
> - #
> - # Group by currency
> - #
> - for inv in list:
> - currency = inv.currency_id.name
> - if tmp.has_key(currency) :
> - tmp[currency].append(inv)
> - else :
> - tmp[currency] = [inv]
> -
> -
> - #
> - # Compute the total for each currency group
> - #
> - for curr in tmp:
> - base = amount = total = 0
> - dic_tax_lines = {}
> - tax_lines = []
> -
> - if vat_taxes or irpf_taxes:
> -
> - for tmpinv in tmp[curr]:
> -
> - inv_factor = tmpinv.type in ('out_refund', 'in_refund') and -1 or 1
> -
> - for tax_line in tmpinv.tax_line:
> -
> - if (tax_line.tax_code_id and ((tax_line.tax_code_id.irpf == irpf_taxes) or (not tax_line.tax_code_id.irpf == vat_taxes))) or not tax_line.tax_code_id:
> -
> - cur = tmpinv.currency_id
> - tax_base = self.pool.get('res.currency').round(self.cr, self.uid, cur, tax_line.base)
> - tax_amount = self.pool.get('res.currency').round(self.cr, self.uid, cur, tax_line.amount)
> -
> - #Caso especial en caso de impuestos intracomunitarios
> - if tax_line.tax_code_id and tax_line.base_code_id.code and (tax_line.base_code_id.code in ('[19]') or tax_line.tax_code_id.code in ('[20]')):
> -
> - added = False
> -
> - for line in self.out_invoices:
> -
> - if line[0] == curr:
> - for taxes in line[1]:
> - if tax_line.name == taxes['name']:
> -
> -
> - taxes['base'] = taxes['base'] + (tax_base * inv_factor)
> - taxes['amount'] = taxes['amount'] - (tax_amount * inv_factor)
> - taxes['total'] = taxes['total'] + ((tax_base * inv_factor) - (tax_amount * inv_factor))
> - line[2] = line[2] + (tax_base * inv_factor)
> - line[3] = line[3] - (tax_amount * inv_factor)
> - line[4] = line[4] + ((tax_base * inv_factor) - (tax_amount * inv_factor))
> - added = True
> - break
> -
> - if not added:
> - line[1].append({
> - 'name': tax_line.name,
> - 'base': (tax_base * inv_factor),
> - 'amount': -(tax_amount * inv_factor),
> - 'total': (tax_base * inv_factor) - (tax_amount * inv_factor)
> - })
> - line[2] = line[2] + (tax_base * inv_factor)
> - line[3] = line[3] - (tax_amount * inv_factor)
> - line[4] = line[4] + ((tax_base * inv_factor) - (tax_amount * inv_factor))
> - added = True
> - break
> -
> - if not added:
> - self.out_invoices.append([curr, [{
> - 'name': tax_line.name,
> - 'base': (tax_base * inv_factor),
> - 'amount': -(tax_amount * inv_factor),
> - 'total': (tax_base * inv_factor) - (tax_amount * inv_factor)
> - }], (tax_base * inv_factor), -(tax_amount * inv_factor), ((tax_base * inv_factor) - (tax_amount * inv_factor))])
> -
> - continue
> -
> - #Caso normal
> - if tax_line.name in dic_tax_lines:
> - dic_tax_lines.update({
> - tax_line.name: {
> - 'name': tax_line.name,
> - 'base': dic_tax_lines[tax_line.name]['base'] + (tax_base * inv_factor),
> - 'amount': dic_tax_lines[tax_line.name]['amount'] + (tax_amount * inv_factor),
> - 'total': dic_tax_lines[tax_line.name]['total'] + ((tax_base * inv_factor) + (tax_amount * inv_factor))
> - }
> - })
> - else:
> - dic_tax_lines.update({
> - tax_line.name: {
> - 'name': tax_line.name,
> - 'base': (tax_base * inv_factor),
> - 'amount': (tax_amount * inv_factor),
> - 'total': (tax_base * inv_factor) + (tax_amount * inv_factor)
> - }
> - })
> -
> - base += (tax_base * inv_factor)
> - amount += (tax_amount * inv_factor)
> - total += (tax_base * inv_factor) + (tax_amount * inv_factor)
> -
> - for tax in dic_tax_lines:
> - tax_lines.append(dic_tax_lines[tax])
> -
> - # Append the tuple to the property
> - dest.append([curr, tax_lines, base, amount, total])
> - del tmp
> -
> -
> - def calculate_differences(self, dest, in_invoices, out_invoices):
> -
> - dic_lines = {}
> -
> - #
> - # Compute the total for each currency group
> - #
> - for line_out in out_invoices:
> - if line_out[0] in dic_lines:
> - dic_lines.update({
> - line_out[0]: {
> - 'currency': line_out[0],
> - 'base': dic_lines[line_out[0]]['base'] + line_out[2],
> - 'amount': dic_lines[line_out[0]]['amount'] + line_out[3],
> - 'total': dic_lines[line_out[0]]['total'] + line_out[4],
> - 'text': (dic_lines[line_out[0]]['amount'] + line_out[3]) >= 0 and _('TO ENTERED') or _('TO RETURNED'),
> - }
> - })
> - else:
> - dic_lines.update({
> - line_out[0]: {
> - 'currency': line_out[0],
> - 'base': line_out[2],
> - 'amount': line_out[3],
> - 'total': line_out[4],
> - 'text': line_out[3] >= 0 and _('TO ENTERED') or _('TO RETURNED'),
> - }
> - })
> -
> - for line_in in in_invoices:
> - if line_in[0] in dic_lines:
> - dic_lines.update({
> - line_in[0]: {
> - 'currency': line_in[0],
> - 'base': dic_lines[line_in[0]]['base'] - line_in[2],
> - 'amount': dic_lines[line_in[0]]['amount'] - line_in[3],
> - 'total': dic_lines[line_in[0]]['total'] - line_in[4],
> - 'text': (dic_lines[line_in[0]]['amount'] - line_in[3]) >= 0 and _('TO ENTERED') or _('TO RETURNED'),
> - }
> - })
> - else:
> - dic_lines.update({
> - line_in[0]: {
> - 'currency': line_in[0],
> - 'base': -line_in[2],
> - 'amount': -line_in[3],
> - 'total': -line_in[4],
> - 'text': -line_in[3] >= 0 and _('TO ENTERED') or _('TO RETURNED'),
> - }
> - })
> -
> - #Return total difference
> - for line in dic_lines:
> - # Append the tuple to the property
> - dest.append(dic_lines[line])
> -
> -
> -report_sxw.report_sxw('report.account.vat.clearance.list.report', 'account.invoice', 'addons/dos_vat_clearance_report/report/vat_clearance_list.rml', parser=print_vat_clearance_list, header=False)
> +from openerp.report import report_sxw
> +from . import rml_parse
> +from openerp.tools.translate import _
> +
> +
> +class PrintVatClearanceList(rml_parse.RmlParse):
> + """ Report that print invoices grouped by currency and type """
> + _name = 'report.account.print_vat_clearance_list'
> +
> + def __init__(self, cr, uid, name, context=None):
> + super(PrintVatClearanceList,
> + self).__init__(cr, uid, name, context=context)
> + # contain tuples of in invoices :
> + # (curreny, [browse records],
> + # currency_untaxed, currency_tax, currency_total)
> + self.in_invoices = []
> + # contain tuples of out invoices :
> + # (curreny, [browse records],currency_untaxed,
> + # currency_tax, currency_total)
> + self.out_invoices = []
> + # contain difference
> + self.differences = []
> + self.localcontext.update({
> + 'time': time,
> + 'in_invoices': self.in_invoices,
> + 'out_invoices': self.out_invoices,
> + 'differences': self.differences,
> + 'vat_taxes': False,
> + 'irpf_taxes': False,
> + 'report_name': '',
> + })
> +
> + def set_context(self, objects, data, ids, report_type=None):
> + """We do the grouping and proccessing of invoices"""
> + invoice_obj = self.pool['account.invoice']
> + if data['model'] == 'ir.ui.menu':
> + invoice_types = []
> + if data['form']['out_invoice']:
> + invoice_types.append('out_invoice')
> + if data['form']['out_refund']:
> + invoice_types.append('out_refund')
> + if data['form']['in_invoice']:
> + invoice_types.append('in_invoice')
> + if data['form']['in_refund']:
> + invoice_types.append('in_refund')
> + invoice_states = []
> + if data['form']['draft']:
> + invoice_states.append('draft')
> + if data['form']['proforma']:
> + invoice_states.append('proforma')
> + invoice_states.append('proforma2')
> + if data['form']['open']:
> + invoice_states.append('open')
> + if data['form']['paid']:
> + invoice_states.append('paid')
> + if data['form']['cancel']:
> + invoice_states.append('cancel')
> + where = [('company_id', '=', data['form']['company_id']),
> + ('type', 'in', invoice_types),
> + ('state', 'in', invoice_states)]
> + if data['form']['state'] in ['byperiod', 'all']:
> + period_ids = data['form']['periods'][0][2]
> + periods = ','.join([str(id) for id in period_ids])
> + where.append(('period_id', 'in', period_ids))
> + if data['form']['state'] in ['bydate', 'all', 'none']:
> + where.append(('date_invoice', '>=', data['form']['date_from']))
> + where.append(('date_invoice', '<=', data['form']['date_to']))
> + # print where
> + ids = invoice_obj.search(self.cr, self.uid, where)
> + objects = invoice_obj.browse(self.cr, self.uid, ids)
> + self.localcontext.update({
> + 'vat_taxes': data['form'].get('vat_taxes'),
> + 'irpf_taxes': data['form'].get('irpf_taxes'),
> + 'report_name': data['form'].get('report_name'),
> + })
> + vat_taxes = data['form'].get('vat_taxes') or False
> + irpf_taxes = data['form'].get('irpf_taxes') or False
> + if not ids:
> + return super(
> + PrintVatClearanceList, self).set_context(objects, data,
> + ids, report_type)
> + if not isinstance(ids, list):
> + ids = [ids]
> + # we create temp list that will be used for store invoices by type
> + ininv = []
> + outinv = []
> + # we get the invoices and sort them by types
> + invoices = invoice_obj.browse(self.cr, self.uid, ids)
> + for inv in invoices:
> + if inv.type in ('in_invoice', 'in_refund'):
> + ininv.append(inv)
> + if inv.type in ('out_invoice', 'out_refund'):
> + outinv.append(inv)
> + # we process the invoice and attribute them to the property
> + self.filter_invoices(outinv, self.out_invoices, vat_taxes, irpf_taxes)
> + self.filter_invoices(ininv, self.in_invoices, vat_taxes, irpf_taxes)
> + if not irpf_taxes:
> + self.calculate_differences(self.differences,
> + self.in_invoices, self.out_invoices)
> + super(PrintVatClearanceList, self).set_context(objects, data, ids,
> + report_type)
> +
> + def filter_invoices(self, list, dest, vat_taxes=False, irpf_taxes=False):
> + if not list:
> + return
> + tmp = {}
> +
> + # Group by currency
> + for inv in list:
> + currency = inv.currency_id.name
> + if currency in tmp:
> + tmp[currency].append(inv)
> + else:
> + tmp[currency] = [inv]
> +
> + # Compute the total for each currency group
> + for curr in tmp:
> + base = amount = total = 0
> + dic_tax_lines = {}
> + tax_lines = []
> + if vat_taxes or irpf_taxes:
> + for tmpinv in tmp[curr]:
> + inv_factor = (tmpinv.type in ('out_refund', 'in_refund')
> + and -1 or 1)
> + for tax_line in tmpinv.tax_line:
> + if ((tax_line.tax_code_id and
> + ((tax_line.tax_code_id.irpf == irpf_taxes) or
> + (not tax_line.tax_code_id.irpf == vat_taxes)))
> + or not tax_line.tax_code_id):
> + cur = tmpinv.currency_id
> + tax_base = self.pool['res.currency'].round(
> + self.cr, self.uid, cur, tax_line.base)
> + tax_amount = self.pool['res.currency'].round(
> + self.cr, self.uid, cur, tax_line.amount)
> + # Caso especial en caso de
> + # impuestos intracomunitarios
> + if (tax_line.tax_code_id and
> + tax_line.base_code_id.code and
> + (tax_line.base_code_id.code in ('[19]') or
> + tax_line.tax_code_id.code in ('[20]'))):
> + added = False
> + for line in self.out_invoices:
> + if line[0] == curr:
> + for taxes in line[1]:
> + if tax_line.name == taxes['name']:
> + taxes['base'] = (
> + taxes['base'] + (tax_base *
> + inv_factor
> + ))
> + taxes['amount'] = (
> + taxes['amount'] -
> + (tax_amount * inv_factor))
> + taxes['total'] = (
> + taxes['total'] +
> + ((tax_base * inv_factor) -
> + (tax_amount * inv_factor)
> + ))
> + line[2] += (tax_base *
> + inv_factor)
> + line[3] -= (tax_amount *
> + inv_factor)
> + line[4] += ((tax_base *
> + inv_factor) -
> + (tax_amount *
> + inv_factor))
> + added = True
> + break
> + if not added:
> + line[1].append({
> + 'name': tax_line.name,
> + 'base': (
> + tax_base * inv_factor),
> + 'amount': -(
> + tax_amount * inv_factor),
> + 'total': ((
> + tax_base * inv_factor) -
> + (tax_amount * inv_factor)
> + )})
> + line[2] += tax_base * inv_factor
> + line[3] -= tax_amount * inv_factor
> + line[4] += ((tax_base * inv_factor)
> + - (tax_amount *
> + inv_factor))
> + added = True
> + break
> + if not added:
> + self.out_invoices.append([curr, [{
> + 'name': tax_line.name,
> + 'base': (tax_base * inv_factor),
> + 'amount': -(tax_amount * inv_factor),
> + 'total': (
> + (tax_base * inv_factor) -
> + (tax_amount * inv_factor))}],
> + (tax_base * inv_factor),
> + -(tax_amount * inv_factor),
> + ((tax_base * inv_factor) -
> + (tax_amount * inv_factor))])
> + continue
> + # Caso normal
> + if tax_line.name in dic_tax_lines:
> + dic_tax_lines.update({
> + tax_line.name: {
> + 'name': tax_line.name,
> + 'base': (
> + dic_tax_lines[tax_line.name]['base']
> + + (tax_base * inv_factor)),
> + 'amount': (
> + dic_tax_lines[tax_line.name]['amount']
> + + (tax_amount * inv_factor)),
> + 'total': (
> + dic_tax_lines[tax_line.name]['total']
> + + ((tax_base * inv_factor) +
> + (tax_amount * inv_factor)))}
> + })
> + else:
> + dic_tax_lines.update({
> + tax_line.name: {
> + 'name': tax_line.name,
> + 'base': (tax_base * inv_factor),
> + 'amount': (tax_amount * inv_factor),
> + 'total': (
> + (tax_base * inv_factor) +
> + (tax_amount * inv_factor))}
> + })
> + base += (tax_base * inv_factor)
> + amount += (tax_amount * inv_factor)
> + total += ((tax_base * inv_factor) +
> + (tax_amount * inv_factor))
> + for tax in dic_tax_lines:
> + tax_lines.append(dic_tax_lines[tax])
> + # Append the tuple to the property
> + dest.append([curr, tax_lines, base, amount, total])
> + del tmp
> +
> + def calculate_differences(self, dest, in_invoices, out_invoices):
> + dic_lines = {}
> +
> + # Compute the total for each currency group
> + for line_out in out_invoices:
> + if line_out[0] in dic_lines:
> + dic_lines.update({
> + line_out[0]: {
> + 'currency': line_out[0],
> + 'base': dic_lines[line_out[0]]['base'] + line_out[2],
> + 'amount': (
> + dic_lines[line_out[0]]['amount'] + line_out[3]),
> + 'total': dic_lines[line_out[0]]['total'] + line_out[4],
> + 'text': ((
> + dic_lines[line_out[0]]['amount'] +
> + line_out[3]) >= 0 and
> + _('TO ENTERED') or _('TO RETURNED'))}
> + })
> + else:
> + dic_lines.update({
> + line_out[0]: {
> + 'currency': line_out[0],
> + 'base': line_out[2],
> + 'amount': line_out[3],
> + 'total': line_out[4],
> + 'text': (line_out[3] >= 0 and
> + _('TO ENTERED') or _('TO RETURNED')),
> + }
> + })
> + for line_in in in_invoices:
> + if line_in[0] in dic_lines:
> + dic_lines.update({
> + line_in[0]: {
> + 'currency': line_in[0],
> + 'base': dic_lines[line_in[0]]['base'] - line_in[2],
> + 'amount': dic_lines[line_in[0]]['amount'] - line_in[3],
> + 'total': dic_lines[line_in[0]]['total'] - line_in[4],
> + 'text': ((dic_lines[line_in[0]]['amount'] -
> + line_in[3]) >= 0 and
> + _('TO ENTERED') or _('TO RETURNED'))}
> + })
> + else:
> + dic_lines.update({
> + line_in[0]: {
> + 'currency': line_in[0],
> + 'base': -line_in[2],
> + 'amount': -line_in[3],
> + 'total': -line_in[4],
> + 'text': -line_in[3] >= 0 and
> + _('TO ENTERED') or _('TO RETURNED'),
> + }
> + })
> + # Return total difference
> + for line in dic_lines:
> + # Append the tuple to the property
> + dest.append(dic_lines[line])
> +
> +report_sxw.report_sxw('report.account.vat.clearance.list.report',
> + 'account.invoice', 'addons/dos_vat_clearance_report/'
> + 'report/vat_clearance_list.rml',
> + parser=PrintVatClearanceList, header=False)
>
> === added directory 'dos_vat_clearance_report/views'
> === renamed file 'dos_vat_clearance_report/account_tax_code_view.xml' => 'dos_vat_clearance_report/views/account_tax_code_view.xml'
> --- dos_vat_clearance_report/account_tax_code_view.xml 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/views/account_tax_code_view.xml 2014-07-10 09:56:24 +0000
> @@ -7,7 +7,6 @@
> <field name="name">account.tax.code.irpf.form</field>
> <field name="model">account.tax.code</field>
> <field name="inherit_id" ref="account.view_tax_code_form"/>
> - <field name="type">form</field>
> <field name="arch" type="xml">
> <field name="company_id" position="after">
> <field name="irpf"/>
>
> === renamed file 'dos_vat_clearance_report/account_report_wizard.xml' => 'dos_vat_clearance_report/wizard/account_report_wizard.xml'
> --- dos_vat_clearance_report/account_report_wizard.xml 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/wizard/account_report_wizard.xml 2014-07-10 09:56:24 +0000
> @@ -1,22 +1,55 @@
> <?xml version="1.0" encoding="UTF-8"?>
> <openerp>
> - <data >
> -
> - # Report Vat Clearance
> - <wizard
> - string="Print Vat Clearance List"
> - model="account.invoice"
> - name="account.vat.clearance.report"
> - menu="False"
> - id="wizard_vat_clearance_report"/>
> -
> - <menuitem
> - name="Print Vat Clearance List"
> - parent="account.menu_finance_generic_reporting"
> - action="wizard_vat_clearance_report"
> - type="wizard"
> - icon="STOCK_PRINT"
> - id="menu_vat_clearance_report"/>
> -
> - </data>
> + <data>
> + <record model="ir.ui.view" id="wizard_vat_clearance_report_form_view">
> + <field name="name">wizard.vat.clearance.report</field>
> + <field name="model">wizard.vat.clearance.report</field>
> + <field name="arch" type="xml">
> + <form string="Vat Clearance List" version="7.0">
> + <field name="company_id" />
> + <field name="report_name" required="True" />
> + <group string="Filter by type">
> + <field name="out_invoice" />
> + <field name="out_refund" />
> + <field name="in_invoice" />
> + <field name="in_refund" />
> + </group>
> + <group string="Filter by state">
> + <field name="draft" />
> + <field name="proforma" />
> + <field name="open" />
> + <field name="paid" />
> + <field name="cancel" />
> + </group>
> + <group string="Filter by date (default current year)">
> + <field name="state" required="True" />
> + <group attrs="{'invisible':[('state','=','none')]}">
> + <group string="Date Filter"
> + attrs="{'invisible':[('state','=','byperiod')]}">
> + <field name="date_from" />
> + <field name="date_to" />
> + </group>
> + <group string="Filter on Periods"
> + attrs="{'invisible':[('state','=','bydate')]}">
> + <field name="periods" nolabel="1" />
> + </group>
> + </group>
> + </group>
> + <group string="Options">
> + <field name="vat_taxes" required="False" />
> + <field name="irpf_taxes" required="False" />
> + </group>
> + </form>
> + </field>
> + </record>
> +
> + <wizard string="Print Vat Clearance List" model="account.invoice"
> + name="account.vat.clearance.report" menu="False"
> + id="wizard_vat_clearance_report" />
> +
> + <menuitem name="Print Vat Clearance List" parent="account.menu_finance_generic_reporting"
> + action="wizard_vat_clearance_report" icon="STOCK_PRINT"
> + id="menu_vat_clearance_report" />
> +
> + </data>
> </openerp>
>
> === modified file 'dos_vat_clearance_report/wizard/wizard_vat_clearance_report.py'
> --- dos_vat_clearance_report/wizard/wizard_vat_clearance_report.py 2014-06-11 10:23:47 +0000
> +++ dos_vat_clearance_report/wizard/wizard_vat_clearance_report.py 2014-07-10 09:56:24 +0000
> @@ -1,7 +1,7 @@
> # -*- encoding: utf-8 -*-
> ##############################################################################
> #
> -# OpenERP, Open Source Management Solution
> +# OpenERP, Open Source Management Solution
> # Copyright (c) 2012 DOS (http://www.dos-sl.es) All Rights Reserved.
> #
> # $Id$
> @@ -21,103 +21,60 @@
> #
> ##############################################################################
>
> -import wizard
> -import pooler
> -import time
> -from tools.translate import _
> -
> -period_form = '''<?xml version="1.0"?>
> -<form string="Vat Clearance List">
> - <field name="company_id"/>
> - <newline/>
> - <field name="report_name" required="True"/>
> - <newline/>
> - <group colspan="4">
> - <separator string="Filter by type" colspan="4"/>
> - <field name="out_invoice"/>
> - <field name="out_refund"/>
> - <field name="in_invoice"/>
> - <field name="in_refund"/>
> - </group>
> - <group colspan="4">
> - <separator string="Filter by state" colspan="4"/>
> - <field name="draft"/>
> - <field name="proforma"/>
> - <field name="open"/>
> - <field name="paid"/>
> - <field name="cancel"/>
> - </group>
> - <group colspan="4">
> - <separator string="Filter by date (default current year)" colspan="4"/>
> - <field name="state" required="True"/>
> - <newline/>
> - <group attrs="{'invisible':[('state','=','none')]}" colspan="4">
> - <group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
> - <separator string="Date Filter" colspan="4"/>
> - <field name="date_from"/>
> - <field name="date_to"/>
> - </group>
> - <group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
> - <separator string="Filter on Periods" colspan="4"/>
> - <field name="periods" colspan="4" nolabel="1"/>
> - </group>
> - </group>
> - </group>
> - <group colspan="4">
> - <separator string="Options" colspan="4"/>
> - <field name="vat_taxes" required="False"/>
> - <field name="irpf_taxes" required="False"/>
> - </group>
> -</form>'''
> -
> -period_fields = {
> - 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
> - 'out_invoice': {'string':'Customer invoices', 'type':'boolean', 'default': lambda *a: True},
> - 'out_refund': {'string':'Customer refunds', 'type':'boolean', 'default': lambda *a: True},
> - 'in_invoice': {'string':'Supplier invoices', 'type':'boolean', 'default': lambda *a: True},
> - 'in_refund': {'string':'Supplier refunds', 'type':'boolean', 'default': lambda *a: True},
> - 'draft': {'string':'Draft', 'type':'boolean',},
> - 'proforma': {'string':'Pro-forma', 'type':'boolean',},
> - 'open': {'string':'Open', 'type':'boolean', 'default': lambda *a: True},
> - 'paid': {'string':'Done', 'type':'boolean', 'default': lambda *a: True},
> - 'cancel': {'string':'Cancelled', 'type':'boolean',},
> - 'vat_taxes': {'string':'VAT taxes', 'type':'boolean', 'default': lambda *a: True},
> - 'irpf_taxes': {'string':'IRPF taxes', 'type':'boolean',},
> - 'state':{
> - 'string':"Date/Period Filter",
> - 'type':'selection',
> - 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
> - 'default': lambda *a:'none'
> - },
> - 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
> - 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
> - 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
> - 'report_name': {'string': 'Report Name', 'type': 'char', 'size': '128', 'default': lambda *a: _('Listado de liquidación de IVA')},
> -}
> -
> -
> -
> -class wizard_report(wizard.interface):
> - def _get_defaults(self, cr, uid, data, context={}):
> - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
> +from openerp.osv import orm, fields
> +import datetime
> +from openerp.tools.translate import _
> +
> +
> +class WizardVatClearanceReport(orm.TransientModel):
> + _name = 'wizard.vat.clearance.report'
> +
> + def _get_defaults(self, cr, uid, data, context=None):
> + user = self.pool['res.users'].browse(cr, uid, uid, context=context)
> if user.company_id:
> company_id = user.company_id.id
> else:
> - company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
> + company_id = self.pool['res.company'].search(
> + cr, uid, [('parent_id', '=', False)], context=context)[0]
> data['form']['company_id'] = company_id
> data['form']['context'] = context
> - return data['form']
> -
> -
> - states = {
> - 'init': {
> - 'actions': [_get_defaults],
> - 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
> - },
> - 'report': {
> - 'actions': [],
> - 'result': {'type':'print', 'report':'account.vat.clearance.list.report', 'state':'end'}
> - }
> - }
> -wizard_report('account.vat.clearance.report')
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> + return data['form']['company_id']
> +
> + _columns = {
> + 'company_id': fields.many2one('res.company', 'Company', required=True),
> + 'out_invoice': fields.boolean('Customer invoices'),
> + 'out_refund': fields.boolean('Customer refunds'),
> + 'in_invoice': fields.boolean('Supplier invoices'),
> + 'in_refund': fields.boolean('Supplier invoices'),
> + 'draft': fields.boolean('Draft'),
> + 'proforma': fields.boolean('Pro-forma'),
> + 'open': fields.boolean('Open'),
> + 'paid': fields.boolean('Done'),
> + 'cancel': fields.boolean('Cancelled'),
> + 'vat_taxes': fields.boolean('VAT taxes'),
> + 'irpf_taxes': fields.boolean('IRPF taxes'),
> + 'state': fields.selection([('bydate', 'By Date'),
> + ('bypediod', 'By Period'),
> + ('all', 'By Date and Period'),
> + ('none', 'No Filter')],
> + "Date/Period Filter"),
> + 'periods': fields.many2many('account.period', string='Period'),
> + 'date_from': fields.date('Start date'),
> + 'date_to': fields.date('End date'),
> + 'report_name': fields.char('Report Name', size=128)
> + }
> +
> + _defaults = {
> + 'out_invoice': True,
> + 'out_refund': True,
> + 'in_invoice': True,
> + 'in_refund': True,
> + 'paid': True,
> + 'open': True,
> + 'vat_taxes': True,
> + 'state': 'none',
> + 'date_from': lambda *a: datetime.strftime('%Y-01-01'),
> + 'date_to': lambda *a: datetime.strftime('%Y-%m-%d'),
> + 'report_name': _('Listado de liquidacion de IVA'),
> + 'company_id': _get_defaults
> + }
>
--
https://code.launchpad.net/~avanzosc-security-team/avanzosc/dos_vat_clearance_report/+merge/226070
Your team Avanzosc_security is subscribed to branch lp:~avanzosc-security-team/avanzosc/72horas.
References