parent
be6cbdf7a2
commit
713a44e836
|
@ -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" : [
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report
|
||||
auto="False"
|
||||
id="legal_vat"
|
||||
menu="False"
|
||||
model="account.tax.code"
|
||||
name="l10n_lu.tax.report.print"
|
||||
string="Luxemburg VAT Declaration"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -10,21 +10,22 @@ This is the same wizard that runs from Financial Managament/Configuration/Financ
|
|||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="legal_lu"
|
||||
parent="account.menu_finance_legal_statement"
|
||||
name="Luxemburg"/>
|
||||
<menuitem
|
||||
id="legal_lu"
|
||||
parent="account.menu_finance_legal_statement"
|
||||
name="Luxemburg"/>
|
||||
|
||||
<wizard
|
||||
id="wizard_print_vat"
|
||||
menu="False"
|
||||
model="account.tax.code"
|
||||
name="l10n_lu.tax.report.wizard" string="Luxemburg VAT Declaration"/>
|
||||
<wizard
|
||||
id="wizard_print_vat"
|
||||
menu="False"
|
||||
model="account.tax.code"
|
||||
name="l10n_lu.tax.report.wizard" string="Luxemburg VAT Declaration"/>
|
||||
|
||||
<menuitem
|
||||
id="legal_lu_vat"
|
||||
parent="legal_lu"
|
||||
action="wizard_print_vat"/>
|
||||
<menuitem
|
||||
id="legal_lu_vat"
|
||||
parent="legal_lu"
|
||||
type="wizard"
|
||||
action="wizard_print_vat"/>
|
||||
|
||||
|
||||
</data>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
import print_vat
|
|
@ -0,0 +1,81 @@
|
|||
# -*- encoding: 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
|
||||
|
||||
|
||||
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 = """<?xml version="1.0"?>
|
||||
<form string="VAT Legal Declaration">
|
||||
<field name="tax_code_id"/>
|
||||
<field name="period_id"/>
|
||||
</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')
|
||||
|
Loading…
Reference in New Issue