From e7ca80cdeb11ebb178ae69ef42276985ddcfbeef Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 13 Feb 2012 18:22:08 +0100 Subject: [PATCH] [FIX] l10n_be: vat intracom statement fix and polish. Thanks Noviat bzr revid: qdp-launchpad@openerp.com-20120213172208-wejitichlxwed4mm --- addons/l10n_be/wizard/l10n_be_vat_intra.py | 38 +++++++------------ .../wizard/l10n_be_vat_intra_print.rml | 4 +- .../l10n_be/wizard/l10n_be_vat_intra_view.xml | 14 +++---- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py index 4364a385b7d..f784d3953e8 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra.py +++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py @@ -4,6 +4,10 @@ # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # +# Adapted by Noviat to +# - make the 'mand_id' field optional +# - support Noviat tax code scheme +# # 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 @@ -54,14 +58,12 @@ class partner_vat_intra(osv.osv_memory): 'period_ids': fields.many2many('account.period', 'account_period_rel', 'acc_id', 'period_id', 'Period (s)', help = 'Select here the period(s) you want to include in your intracom declaration'), 'tax_code_id': fields.many2one('account.tax.code', 'Company', domain=[('parent_id', '=', False)], help="Keep empty to use the user's company", required=True), 'test_xml': fields.boolean('Test XML file', help="Sets the XML output as test file"), - 'mand_id' : fields.char('MandataireId', size=14, required=True, help="This identifies the representative of the sending company. This is a string of 14 characters"), + 'mand_id' : fields.char('Reference', size=14, help="Reference given by the Representative of the sending company."), 'msg': fields.text('File created', size=14, readonly=True), 'no_vat': fields.text('Partner With No VAT', size=14, readonly=True, help="The Partner whose VAT number is not defined they doesn't include in XML File."), 'file_save' : fields.binary('Save File', readonly=True), 'country_ids': fields.many2many('res.country', 'vat_country_rel', 'vat_id', 'country_id', 'European Countries'), 'comments': fields.text('Comments'), - 'identification_type': fields.selection([('tin','TIN'), ('nvat','NVAT'), ('other','Other')], 'Identification Type', required=True), - 'other': fields.char('Other Qlf', size=16, help="Description of Identification Type"), } def _get_tax_code(self, cr, uid, context=None): @@ -75,7 +77,6 @@ class partner_vat_intra(osv.osv_memory): 'country_ids': _get_europe_country, 'file_save': _get_xml_data, 'name': 'vat_intra.xml', - 'identification_type': 'nvat', 'tax_code_id': _get_tax_code, } @@ -98,8 +99,6 @@ class partner_vat_intra(osv.osv_memory): seq = amount_sum = 0 wiz_data = self.browse(cr, uid, ids[0], context=context) - type = wiz_data.identification_type or '' - other = wiz_data.other or '' comments = wiz_data.comments if wiz_data.tax_code_id: @@ -164,8 +163,6 @@ class partner_vat_intra(osv.osv_memory): 'period': wiz_data.period_code, 'clientlist': [], 'comments': comments, - 'type': type.upper(), - 'other': other, 'issued_by': issued_by, }) @@ -196,7 +193,6 @@ class partner_vat_intra(osv.osv_memory): amount_sum += amt intra_code = row['intra_code'] == '44' and 'S' or (row['intra_code'] == '46L' and 'L' or (row['intra_code'] == '46T' and 'T' or '')) -# intra_code = row['intra_code'] == '88' and 'L' or (row['intra_code'] == '44b' and 'T' or (row['intra_code'] == '44a' and 'S' or '')) xmldict['clientlist'].append({ 'partner_name': row['partner_name'], @@ -221,17 +217,12 @@ class partner_vat_intra(osv.osv_memory): month_quarter = xml_data['period'][:2] year = xml_data['period'][2:] data_file = '' - #for country in xml_data['clientlist']: - # if country['country'] == 'BE': - # country['country'] = '' - # else: - # country['country'] = country['country'] # Can't we do this by etree? data_head = """ - %(company_vat)s + %(company_vat)s %(company_name)s %(street)s %(post_code)s @@ -239,14 +230,14 @@ class partner_vat_intra(osv.osv_memory): %(country)s %(email)s %(phone)s - -%(mand_id)s""" % (xml_data) - + """ % (xml_data) + if xml_data['mand_id']: + data_head += '\n\t\t%(mand_id)s' % (xml_data) data_comp_period = '\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(company_name)s\n\t\t\t%(street)s\n\t\t\t%(post_code)s\n\t\t\t%(city)s\n\t\t\t%(country)s\n\t\t\t%(email)s\n\t\t\t%(phone)s\n\t\t' % (xml_data) if month_quarter.startswith('3'): - data_comp_period += '\n\t\t\n\t\t\t'+month_quarter+' \n\t\t\t'+year+'\n\t\t' + data_comp_period += '\n\t\t\n\t\t\t'+month_quarter[1]+' \n\t\t\t'+year+'\n\t\t' elif month_quarter.startswith('0') and month_quarter.endswith('0'): - data_comp_period+= '\n\t\t%(period)s' % (xml_data) + data_comp_period+= '\n\t\t\n\t\t\t'+year+'\n\t\t' else: data_comp_period += '\n\t\t\n\t\t\t'+month_quarter+' \n\t\t\t'+year+'\n\t\t' @@ -254,7 +245,7 @@ class partner_vat_intra(osv.osv_memory): for client in xml_data['clientlist']: if not client['vatnum']: raise osv.except_osv(_('Data Insufficient!'),_('No vat number defined for %s') % client['partner_name']) - data_clientinfo +='\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(code)s\n\t\t\t%(amount)s\n\t\t\t' % (client) + data_clientinfo +='\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(code)s\n\t\t\t%(amount)s\n\t\t' % (client) data_decl = '\n\t' % (xml_data) @@ -289,18 +280,15 @@ class partner_vat_intra(osv.osv_memory): 'datas': datas, } - partner_vat_intra() - class vat_intra_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(vat_intra_print, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) - + report_sxw.report_sxw('report.partner.vat.intra.print', 'partner.vat.intra', 'addons/l10n_be/wizard/l10n_be_vat_intra_print.rml', parser=vat_intra_print, header="internal") - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra_print.rml b/addons/l10n_be/wizard/l10n_be_vat_intra_print.rml index c9275caae48..415f3a08f1f 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra_print.rml +++ b/addons/l10n_be/wizard/l10n_be_vat_intra_print.rml @@ -87,7 +87,7 @@ Partner VAT - Tax Code + Code (Tax Code) Amount @@ -105,7 +105,7 @@ [[ l['vat'] ]] - [[ l['intra_code'] ]] + [[ l['code'] (l['intra_code']) ]] [[ l['amount'] or O.OO ]] [[ company.currency_id.symbol ]] diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml b/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml index 08639f50685..cc7609558ff 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml +++ b/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml @@ -14,15 +14,13 @@ - + + + - - + @@ -72,9 +70,9 @@ + id="l10n_be.l10_be_vat_intra"/>