[IMP] l10n_fr, l10n_lu: wizards converted to osv memory type, renaming of files

bzr revid: mra@mra-laptop-20100817114756-45vo32nh89xs2t9i
This commit is contained in:
PAP(OpenERP) 2010-08-17 17:17:56 +05:30 committed by Mustufa Rangwala
parent 6b4adfbab2
commit c7744cc08a
29 changed files with 210 additions and 215 deletions

View File

@ -29,5 +29,6 @@
import l10n_fr import l10n_fr
import report import report
import wizard import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -38,16 +38,15 @@ Credits: Sistheo Zeekom CrysaLEAD
"depends" : ['base', 'account', 'account_chart', 'account_report', 'base_vat'], "depends" : ['base', 'account', 'account_chart', 'account_report', 'base_vat'],
"init_xml" : [], "init_xml" : [],
"update_xml" : [ "update_xml" : [
"report.xml", "report_demo.xml",
"pcg.xml", "plan_comptable_general_demo.xml",
"l10n_fr_pcg_taxes.xml", "fr_pcg_taxes_demo.xml",
"tax.xml", "tax_demo.xml",
"fiscal_templates_fr.xml", "fr_fiscal_templates_demo.xml",
"l10n_fr_pcg_account_report.xml", "fr_pcg_account_report_demo.xml",
"l10n_fr_pcg_report.xml",
"l10n_fr_pcg_wizard.xml",
"l10n_fr_pcg_view.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",
"wizard/bilan_report_view.xml",
"wizard/compute_resultant_report_view.xml",
], ],
"demo_xml" : [], "demo_xml" : [],
"certificate" : "00435321693876313629", "certificate" : "00435321693876313629",

View File

@ -19,12 +19,7 @@
# #
############################################################################## ##############################################################################
from mx import DateTime
import time
from osv import fields, osv from osv import fields, osv
import pooler
class l10n_fr_report(osv.osv): class l10n_fr_report(osv.osv):
_name = 'l10n.fr.report' _name = 'l10n.fr.report'

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="l10n_fr_pcg_cdr"
string="Compte de resultat"
model="account.move.line"
name="l10n.fr.cdr"
rml="l10n_fr/report/cdr.rml"
auto="True"
menu="True"
/>
<report id="l10n_fr_pcg_bilan"
string="Bilan"
model="account.move.line"
name="l10n.fr.bilan"
rml="l10n_fr/report/bilan.rml"
auto="True"
menu="True"
/>
</data>
</openerp>

View File

@ -1,5 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
</data>
</openerp>

View File

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<wizard id="wizard_l10n_fr_pcg_cdr_report"
string="Compte de resultat"
model="account.move.line"
name="l10n.fr.cdr.report"
keyword="client_print_multi"
/>
<wizard id="wizard_l10n_fr_pcg_bilan_report"
string="Bilan"
model="account.move.line"
name="l10n.fr.bilan.report"
keyword="client_print_multi"
/>
<record id="config_call_account_template_fr_pcg" model="ir.actions.todo">
<field name="name">Generate Chart of Accounts from a Chart Template</field>
<field name="note">Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.
This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template.</field>
<field name="action_id" ref="account.action_wizard_multi_chart"/>
<field name="restart">onskip</field>
</record>
</data>
</openerp>

View File

@ -27,7 +27,8 @@
############################################################################## ##############################################################################
import base_report import base_report
import bilan import bilan_report
import cdr import compute_resultant_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -33,7 +33,7 @@ class bilan(base_report.base_report):
def __init__(self, cr, uid, name, context): def __init__(self, cr, uid, name, context):
super(bilan, self).__init__(cr, uid, name, context) super(bilan, self).__init__(cr, uid, name, context)
report_sxw.report_sxw('report.l10n.fr.bilan', 'account.move.line','addons/l10n_fr/report/bilan.rml', parser=bilan, header=False) report_sxw.report_sxw('report.l10n.fr.bilan', 'account.move.line','addons/l10n_fr/report/bilan_report.rml', parser=bilan, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -33,7 +33,7 @@ class cdr(base_report.base_report):
def __init__(self, cr, uid, name, context): def __init__(self, cr, uid, name, context):
super(cdr, self).__init__(cr, uid, name, context) super(cdr, self).__init__(cr, uid, name, context)
report_sxw.report_sxw('report.l10n.fr.cdr', 'account.move.line','addons/l10n_fr/report/cdr.rml', parser=cdr, header=False) report_sxw.report_sxw('report.l10n.fr.compute_resultant', 'account.move.line','addons/l10n_fr/report/compute_resultant_report.rml', parser=cdr, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -26,7 +26,8 @@
# #
############################################################################## ##############################################################################
import bilan import fr_report_bilan
import cdr import fr_report_compute_resultant
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="bilan_report_view" model="ir.ui.view">
<field name="name">Bilan Report</field>
<field name="model">account.bilan.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<field name="fiscalyear_id"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="print_bilan_report" string="Print" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_account_bilan_report" model="ir.actions.act_window">
<field name="name">Bilan Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bilan.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="bilan_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_bilan_report_values">
<field name="model_id" ref="model_account_bilan_report" />
<field name="object" eval="1" />
<field name="name">Bilan Report</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_bilan_report'))" />
<field name="key">action</field>
<field name="model">account.move.line</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="cdr_report_view" model="ir.ui.view">
<field name="name">Compte de resultat Report</field>
<field name="model">account.cdr.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<field name="fiscalyear_id"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="print_cdr_report" string="Print" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_account_cdr_report" model="ir.actions.act_window">
<field name="name">Compte de resultat Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.cdr.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="cdr_report_view"/>
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_cdr_report_values">
<field name="model_id" ref="model_account_cdr_report" />
<field name="object" eval="1" />
<field name="name">Compte de resultat Report</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_cdr_report'))" />
<field name="key">action</field>
<field name="model">account.move.line</field>
</record>
</data>
</openerp>

View File

@ -26,35 +26,31 @@
# #
############################################################################## ##############################################################################
import wizard from osv import osv, fields
import pooler
dates_form = '''<?xml version="1.0"?> class account_bilan_report(osv.osv_memory):
<form string="Select year"> _name = 'account.bilan.report'
<field name="fiscalyear" colspan="4"/> _description = 'Account Bilan Report'
</form>'''
dates_fields = { def _get_default_fiscalyear(self, cr, uid, context):
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True} fiscalyear_id = self.pool.get('account.fiscalyear').find(cr, uid)
} return fiscalyear_id
class wizard_report(wizard.interface): _columns = {
def _get_defaults(self, cr, uid, data, context): 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True),
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] =fiscalyear_obj.find(cr, uid)
return data['form']
states = {
'init': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'l10n.fr.bilan', 'state':'end'}
} }
_defaults = {
'fiscalyear_id':_get_default_fiscalyear
} }
wizard_report('l10n.fr.bilan.report')
def print_bilan_report(self, cr, uid, ids, context=None):
active_ids = context.get('active_ids',[])
data = {}
data['form'] = {}
data['ids'] = active_ids
data['form']['fiscalyear'] = self.browse(cr, uid, ids)[0].fiscalyear_id.id
return {'type': 'ir.actions.report.xml', 'report_name': 'l10n.fr.bilan', 'datas': data }
account_bilan_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -26,35 +26,33 @@
# #
############################################################################## ##############################################################################
import wizard from osv import osv, fields
import pooler
dates_form = '''<?xml version="1.0"?> class account_cdr_report(osv.osv_memory):
<form string="Select period"> _name = 'account.cdr.report'
<field name="fiscalyear" colspan="4"/> _description = 'Account CDR Report'
</form>'''
dates_fields = { def _get_defaults(self, cr, uid, context):
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True} fiscalyear_obj = self.pool.get('account.fiscalyear')
} fiscalyear_id = fiscalyear_obj.find(cr, uid)
return fiscalyear_id
class wizard_report(wizard.interface): _columns = {
def _get_defaults(self, cr, uid, data, context): 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True),
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
return data['form']
states = {
'init': {
'actions': [_get_defaults],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'l10n.fr.cdr', 'state':'end'}
} }
_defaults = {
'fiscalyear_id': _get_defaults
} }
wizard_report('l10n.fr.cdr.report')
def print_cdr_report(self, cr, uid, ids, context=None):
active_ids = context.get('active_ids',[])
data = {}
data['form'] = {}
data['ids'] = active_ids
data['form']['fiscalyear'] = self.browse(cr, uid, ids)[0].fiscalyear_id.id
return { 'type': 'ir.actions.report.xml', 'report_name': 'l10n.fr.compute_resultant', 'datas': data}
account_cdr_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,5 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import wizard import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -38,8 +38,7 @@ This module installs:
'account.tax.code.template.csv', 'account.tax.code.template.csv',
'l10n_lu_data.xml', 'l10n_lu_data.xml',
'account.tax.template.csv', 'account.tax.template.csv',
'l10n_lu_wizard.xml', 'wizard/print_vat_view.xml'
'l10n_lu_report.xml'
], ],
'demo_xml': ['account.report.report.csv'], 'demo_xml': ['account.report.report.csv'],
'installable': True, 'installable': True,

View File

@ -1,12 +0,0 @@
<?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="Luxembourg VAT Declaration"/>
</data>
</openerp>

View File

@ -1,29 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="config_call_account_template" model="ir.actions.todo">
<field name="action_id" ref="account.action_wizard_multi_chart"/>
<field name="restart">onskip</field>
</record>
<menuitem
id="legal_lu"
parent="account.menu_finance_legal_statement"
name="Luxembourg"/>
<wizard
id="wizard_print_vat"
menu="False"
model="account.tax.code"
name="l10n_lu.tax.report.wizard" string="VAT Declaration"/>
<menuitem
id="legal_lu_vat"
parent="legal_lu"
type="wizard"
action="wizard_print_vat"/>
</data>
</openerp>

View File

@ -20,4 +20,5 @@
############################################################################## ##############################################################################
import print_vat import print_vat
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -4,39 +4,13 @@
#Ingenieur fondateur #Ingenieur fondateur
#Tranquil IT Systems #Tranquil IT Systems
from osv import osv, fields
import wizard
import time
import datetime
import pooler import pooler
import sys
from mx.DateTime import *
import tools import tools
from tools.translate import _
from report.render import render from report.render import render
from report.interface import report_int 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): class external_pdf(render):
def __init__(self, pdf): def __init__(self, pdf):
@ -56,9 +30,8 @@ class report_custom(report_int):
code_ids = taxobj.search(cr, uid, [('parent_id','child_of',[datas['form']['tax_code_id']])]) code_ids = taxobj.search(cr, uid, [('parent_id','child_of',[datas['form']['tax_code_id']])])
result = {} result = {}
for t in taxobj.browse(cr, uid, code_ids, {'period_id': datas['form']['period_id']}): for t in taxobj.browse(cr, uid, code_ids, {'period_id': datas['form']['period_id']}):
if t.code: if str(t.code):
result['case_'+str(t.code)] = '%.2f' % (t.sum_period or 0.0, ) result['case_'+str(t.code)] = '%.2f' % (t.sum_period or 0.0, )
user = pool.get('res.users').browse(cr, uid, uid, context) user = pool.get('res.users').browse(cr, uid, uid, context)
# Not Clean, to be changed # Not Clean, to be changed
@ -68,26 +41,34 @@ class report_custom(report_int):
if partner.address: if partner.address:
result['info_address'] = partner.address[0].street result['info_address'] = partner.address[0].street
result['info_address2'] = (partner.address[0].zip or '') + ' ' + (partner.address[0].city or '') result['info_address2'] = (partner.address[0].zip or '') + ' ' + (partner.address[0].city or '')
try:
tools.pdf_utils.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result) tools.pdf_utils.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result)
self.obj = external_pdf(file('/tmp/output.pdf').read()) self.obj = external_pdf(file('/tmp/output.pdf').read())
self.obj.render() self.obj.render()
return (self.obj.pdf, 'pdf') return (self.obj.pdf, 'pdf')
except Exception, e:
raise osv.except_osv(_('pdf not created !'), _('Please check if package pdftk is installed!'))
report_custom('report.l10n_lu.tax.report.print') report_custom('report.l10n_lu.tax.report.print')
class vat_declaration_report(osv.osv_memory):
_name = 'vat.declaration.report'
_description = 'VAT Declaration Report'
class wizard_report(wizard.interface): _columns = {
states = { 'tax_code_id': fields.many2one('account.tax.code', 'Company', required=True, domain=[('parent_id','=',False)]),
'init': { 'period_id' : fields.many2one('account.period', 'Period', required=True)
'actions': [],
'result': {'type':'form', 'arch':_tax_form, 'fields':_tax_fields, 'state':[('end','Cancel'),('pdf','Print Taxes Statement')]},
},
'pdf': {
'actions': [],
'result': {'type':'print', 'report': 'l10n_lu.tax.report.print', 'state':'end'},
},
} }
wizard_report('l10n_lu.tax.report.wizard')
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}
vat_declaration_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,34 @@
<?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="type">form</field>
<field name="arch" type="xml">
<form>
<field name="tax_code_id" widget="selection"/>
<field name="period_id" widget="selection"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="print_vat_declaration_report" string="Print Tax Statements" type="object" icon="gtk-ok"/>
</group>
</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>