[REM] Removed the luxembourg tax report (this report is now deprecated as LU only accepts xml etva or onlineform filling)
bzr revid: sle@openerp.com-20140403212238-rf85l911i2g5da3t
This commit is contained in:
parent
a1f08e0d10
commit
0cbd5fb87b
|
@ -19,6 +19,4 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Luxembourg - Accounting',
|
||||
'version': '1.0',
|
||||
|
@ -51,12 +50,12 @@ This is the base module to manage the accounting chart for Luxembourg.
|
|||
'account.fiscal.position.tax.template-2011.csv',
|
||||
# configuration wizard, views, reports...
|
||||
'l10n_lu_wizard.xml',
|
||||
'wizard/print_vat_view.xml'
|
||||
],
|
||||
'test': ['test/l10n_lu_report.yml'],
|
||||
'test': [],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'images': ['images/config_chart_l10n_lu.jpeg','images/l10n_lu_chart.jpeg'],
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
-
|
||||
It is demo data for the account.tax.code
|
||||
-
|
||||
!record {model: account.tax.code, id: account_tax_code_id_r1}:
|
||||
name: a
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a l10u_lu, we will print a VAT Report
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [], 'l10n_lu.tax.report.print', {'model':'ir.ui.menu', 'form':{'tax_code_id': ref('account_tax_code_id_r1'), 'period_id': ref('account.period_1')}}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'l10n_lu-vat_report.'+format), 'wb+').write(data)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import print_vat
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,110 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
""" Copyright (c) 2003-2007 LOGILAB S.A. (Paris, FRANCE).
|
||||
http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
||||
|
||||
manipulate pdf and fdf files. pdftk recommended.
|
||||
|
||||
Notes regarding pdftk, pdf forms and fdf files (form definition file)
|
||||
fields names can be extracted with:
|
||||
pdftk orig.pdf generate_fdf output truc.fdf
|
||||
to merge fdf and pdf:
|
||||
pdftk orig.pdf fill_form test.fdf output result.pdf [flatten]
|
||||
without flatten, one could further edit the resulting form.
|
||||
with flatten, everything is turned into text.
|
||||
"""
|
||||
|
||||
import os
|
||||
from openerp import tools
|
||||
|
||||
HEAD="""%FDF-1.2
|
||||
%\xE2\xE3\xCF\xD3
|
||||
1 0 obj
|
||||
<<
|
||||
/FDF
|
||||
<<
|
||||
/Fields [
|
||||
"""
|
||||
|
||||
TAIL="""]
|
||||
>>
|
||||
>>
|
||||
endobj
|
||||
trailer
|
||||
|
||||
<<
|
||||
/Root 1 0 R
|
||||
>>
|
||||
%%EOF
|
||||
"""
|
||||
|
||||
def output_field(f):
|
||||
return "\xfe\xff" + "".join( [ "\x00"+c for c in f ] )
|
||||
|
||||
def extract_keys(lines):
|
||||
keys = []
|
||||
for line in lines:
|
||||
if line.startswith('/V'):
|
||||
pass
|
||||
elif line.startswith('/T'):
|
||||
key = line[7:-2]
|
||||
key = ''.join(key.split('\x00'))
|
||||
keys.append( key )
|
||||
return keys
|
||||
|
||||
def write_field(out, key, value):
|
||||
out.write("<<\n")
|
||||
if value:
|
||||
out.write("/V (%s)\n" %value)
|
||||
else:
|
||||
out.write("/V /\n")
|
||||
out.write("/T (%s)\n" % output_field(key) )
|
||||
out.write(">> \n")
|
||||
|
||||
def write_fields(out, fields):
|
||||
out.write(HEAD)
|
||||
for key in fields:
|
||||
value = fields[key]
|
||||
write_field(out, key, value)
|
||||
out.write(TAIL)
|
||||
|
||||
def extract_keys_from_pdf(filename):
|
||||
# what about using 'pdftk filename dump_data_fields' and parsing the output ?
|
||||
os.system('pdftk %s generate_fdf output /tmp/toto.fdf' % filename)
|
||||
lines = file('/tmp/toto.fdf').readlines()
|
||||
return extract_keys(lines)
|
||||
|
||||
|
||||
def fill_pdf(infile, outfile, fields):
|
||||
write_fields(file('/tmp/toto.fdf', 'w'), fields)
|
||||
os.system('pdftk %s fill_form /tmp/toto.fdf output %s flatten' % (infile, outfile))
|
||||
|
||||
def testfill_pdf(infile, outfile):
|
||||
keys = extract_keys_from_pdf(infile)
|
||||
fields = []
|
||||
for key in keys:
|
||||
fields.append( (key, key, '') )
|
||||
fill_pdf(infile, outfile, fields)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#Copyright (c) Vincent Cardon <vincent.cardon@tranquil-it-systems.fr>
|
||||
# Denis Cardon <denis.cardon@tranquilitsystems.com> and Emmanuel RICHARD.
|
||||
#Ingenieur fondateur
|
||||
#Tranquil IT Systems
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import openerp
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import tools
|
||||
from openerp.modules.module import get_module_resource
|
||||
from openerp.tools.translate import _
|
||||
from openerp.report.render import render
|
||||
from openerp.report.interface import report_int
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
class external_pdf(render):
|
||||
|
||||
def __init__(self, pdf):
|
||||
render.__init__(self)
|
||||
self.pdf = pdf
|
||||
self.output_type='pdf'
|
||||
|
||||
def _render(self):
|
||||
return self.pdf
|
||||
|
||||
|
||||
class report_custom(report_int):
|
||||
|
||||
def create(self, cr, uid, ids, datas, context=None):
|
||||
|
||||
registry = openerp.registry(cr.dbname)
|
||||
taxobj = registry['account.tax.code']
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
code_ids = taxobj.search(cr, uid, [('parent_id','child_of',[datas['form']['tax_code_id']])])
|
||||
result = {}
|
||||
for t in taxobj.browse(cr, uid, code_ids, {'period_id': datas['form']['period_id']}):
|
||||
if str(t.code):
|
||||
result['case_'+str(t.code)] = '%.2f' % (t.sum_period or 0.0, )
|
||||
user = registry['res.users'].browse(cr, uid, uid, context)
|
||||
|
||||
# Not Clean, to be changed
|
||||
partner = user.company_id.partner_id
|
||||
result['info_name'] = user.company_id.name
|
||||
result['info_vatnum'] = partner.vat
|
||||
if partner:
|
||||
result['info_address'] = partner.street
|
||||
result['info_address2'] = (partner.zip or '') + ' ' + (partner.city or '')
|
||||
try:
|
||||
tmp_file = tempfile.mkstemp(".pdf")[1]
|
||||
try:
|
||||
tools.pdf_utils.fill_pdf(get_module_resource('l10n_lu','wizard', '2008_DECL_F_M10.pdf'), tmp_file, result)
|
||||
with open(tmp_file, "r") as ofile:
|
||||
self.obj = external_pdf(ofile.read())
|
||||
finally:
|
||||
try:
|
||||
os.remove(tmp_file)
|
||||
except:
|
||||
pass # nothing to do
|
||||
self.obj.render()
|
||||
return (self.obj.pdf, 'pdf')
|
||||
except Exception:
|
||||
raise osv.except_osv(_('PDF Not Created!'), _('Please check if package pdftk is installed!'))
|
||||
|
||||
report_custom('report.l10n_lu.tax.report.print')
|
||||
|
||||
class vat_declaration_report(osv.osv_memory):
|
||||
_name = 'vat.declaration.report'
|
||||
_description = 'VAT Declaration Report'
|
||||
|
||||
_columns = {
|
||||
'tax_code_id': fields.many2one('account.tax.code', 'Company', readonly=False, required=True, domain=[('parent_id','=',False)]),
|
||||
'type': fields.selection([('monthly','Monthly'),('quarterly','Quaterly'),('yearly','Yearly')], 'Type', required=True),
|
||||
'period_id' : fields.many2one('account.period', 'From Period', required=True),
|
||||
'to_period_id': fields.many2one('account.period', 'To Period', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'type': 'monthly',
|
||||
}
|
||||
|
||||
def print_vat_declaration_report(self, cr, uid, ids, context=None):
|
||||
active_ids = context.get('active_ids',[])
|
||||
data = {}
|
||||
data['form'] = {}
|
||||
data['ids'] = active_ids
|
||||
data['form']['tax_code_id'] = self.browse(cr, uid, ids)[0].tax_code_id.id
|
||||
data['form']['period_id'] = self.browse(cr, uid, ids)[0].period_id.id
|
||||
return { 'type': 'ir.actions.report.xml', 'report_name': 'l10n_lu.tax.report.print', 'datas': data}
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="vat_report_view" model="ir.ui.view">
|
||||
<field name="name">VAT Declaration Report</field>
|
||||
<field name="model">vat.declaration.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Print Tax Statements" version="7.0">
|
||||
<group col="4">
|
||||
<field name="tax_code_id" widget="selection"/>
|
||||
<field name="type"/>
|
||||
<field name="period_id" widget="selection"/>
|
||||
<field name="to_period_id" widget="selection"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="print_vat_declaration_report" string="Print Tax Statements" type="object" class="oe_highlight" />
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_vat_report" model="ir.actions.act_window">
|
||||
<field name="name">VAT Declaration Report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">vat.declaration.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="vat_report_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="legal_lu" parent="account.menu_finance_legal_statement" name="Luxembourg"/>
|
||||
<menuitem name="VAT Declaration" id="legal_lu_vat" parent="legal_lu" action="action_vat_report"/>
|
||||
|
||||
</data>
|
||||
|
||||
</openerp>
|
Loading…
Reference in New Issue