From 713a44e8364a2524b88d3217e2de6381c528c609 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 14 Oct 2008 16:08:35 +0200 Subject: [PATCH] addinglu bzr revid: fp@tinyerp.com-20081014140835-lxeorwpgogchitnc --- addons/l10n_lu/__terp__.py | 2 +- addons/l10n_lu/l10n_lu_report.xml | 12 ++++++ addons/l10n_lu/l10n_lu_wizard.xml | 27 ++++++------ addons/l10n_lu/wizard/__init__.py | 1 + addons/l10n_lu/wizard/print_vat.py | 81 ++++++++++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 14 deletions(-) create mode 100644 addons/l10n_lu/l10n_lu_report.xml create mode 100644 addons/l10n_lu/wizard/__init__.py create mode 100644 addons/l10n_lu/wizard/print_vat.py diff --git a/addons/l10n_lu/__terp__.py b/addons/l10n_lu/__terp__.py index 61d131c..70f9036 100644 --- a/addons/l10n_lu/__terp__.py +++ b/addons/l10n_lu/__terp__.py @@ -10,7 +10,7 @@ This module install: *the KLUWER Chart of Accounts, *the Tax Code Chart for Luxembourg *the main taxes used in Luxembourg""", - "depends" : ["account","base"], + "depends" : ["account","account_report"], "init_xml" : [ ], "demo_xml" : [ "account.report.report.csv" ], "update_xml" : [ diff --git a/addons/l10n_lu/l10n_lu_report.xml b/addons/l10n_lu/l10n_lu_report.xml new file mode 100644 index 0000000..192b603 --- /dev/null +++ b/addons/l10n_lu/l10n_lu_report.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/addons/l10n_lu/l10n_lu_wizard.xml b/addons/l10n_lu/l10n_lu_wizard.xml index 6820911..127ff4a 100644 --- a/addons/l10n_lu/l10n_lu_wizard.xml +++ b/addons/l10n_lu/l10n_lu_wizard.xml @@ -10,21 +10,22 @@ This is the same wizard that runs from Financial Managament/Configuration/Financ open - + - + - + diff --git a/addons/l10n_lu/wizard/__init__.py b/addons/l10n_lu/wizard/__init__.py new file mode 100644 index 0000000..0ff0d08 --- /dev/null +++ b/addons/l10n_lu/wizard/__init__.py @@ -0,0 +1 @@ +import print_vat diff --git a/addons/l10n_lu/wizard/print_vat.py b/addons/l10n_lu/wizard/print_vat.py new file mode 100644 index 0000000..1060939 --- /dev/null +++ b/addons/l10n_lu/wizard/print_vat.py @@ -0,0 +1,81 @@ +# -*- encoding: utf-8 -*- +#Copyright (c) Vincent Cardon +# Denis Cardon and Emmanuel RICHARD. +#Ingenieur fondateur +#Tranquil IT Systems + + +import wizard +import time +import datetime +import pooler +import sys +from mx.DateTime import * +import tools +from report.render import render +from report.interface import report_int +import os + +_tax_form = """ +
+ + +""" + +_tax_fields = { + 'tax_code_id': { + 'string': 'Company', + 'type': 'many2one', + 'relation': 'account.tax.code', + 'required': True, + 'domain': [('parent_id','=',False)]}, + 'period_id': { + 'string':'Period', + 'type': 'many2one', + 'relation': 'account.period', + 'required':True + } +} + +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={}): + print datas, ids, uid + + taxobj = self.pool.get('account.tax.code') + 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 t.code: + result[t.code] = t.sum_period + os.system('pdftk... output /tmp/tax.pdf') + self.obj = external_pdf(file('/tmp/tax.pdf').read()) + self.obj.render() + + pdf_string.close() + return (self.obj.pdf, 'pdf') + +report_custom('report.l10n_lu.tax.report.print') + + +class wizard_report(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type':'form', 'arch':_tax_form, 'fields':_tax_fields, 'state':[('end','Cancel'),('pdf','Print Balance Sheet')]}, + }, + 'pdf': { + 'actions': [], + 'result': {'type':'print', 'report': 'l10n_lu.tax.report.print', 'state':'end'}, + }, + } +wizard_report('l10n_lu.tax.report.wizard') + -- 1.7.10.4